from header_common import *
from header_presentations import *
from header_mission_templates import *
from ID_meshes import *
from header_operations import *
from header_triggers import *
from module_constants import *
import string

from header_skills import *
from header_items import *
from module_items import *
from module_factions import *
from ID_factions import *
from header_triggers import *
from module_my_mod_set import *
from header_terrain_types import *

####################################################################################################################
#  Each presentation record contains the following fields:
#  1) Presentation id: used for referencing presentations in other files. The prefix prsnt_ is automatically added before each presentation id.
#  2) Presentation flags. See header_presentations.py for a list of available flags
#  3) Presentation background mesh: See module_meshes.py for a list of available background meshes
#  4) Triggers: Simple triggers that are associated with the presentation
####################################################################################################################

presentations = [

("game_credits", prsntf_read_only, mesh_load_window, [
    (ti_on_presentation_load, [
        (assign, "$g_presentation_credits_obj_1", -1),
        (assign, "$g_presentation_credits_obj_2", -1),
        (assign, "$g_presentation_credits_obj_3", -1),
        (assign, "$g_presentation_credits_obj_4", -1),
        (assign, "$g_presentation_credits_obj_5", -1),
        (assign, "$g_presentation_credits_obj_6", -1),
        (assign, "$g_presentation_credits_obj_7", -1),
        (assign, "$g_presentation_credits_obj_8", -1),
        (assign, "$g_presentation_credits_obj_9", -1),
        (assign, "$g_presentation_credits_obj_10", -1),
        (assign, "$g_presentation_credits_obj_11", -1),
        (assign, "$g_presentation_credits_obj_12", -1),
        (assign, "$g_presentation_credits_obj_1_alpha", 0),
        (assign, "$g_presentation_credits_obj_2_alpha", 0),
        (assign, "$g_presentation_credits_obj_3_alpha", 0),
        (assign, "$g_presentation_credits_obj_4_alpha", 0),
        (assign, "$g_presentation_credits_obj_5_alpha", 0),
        (assign, "$g_presentation_credits_obj_6_alpha", 0),
        (assign, "$g_presentation_credits_obj_7_alpha", 0),
        (assign, "$g_presentation_credits_obj_8_alpha", 0),
        (assign, "$g_presentation_credits_obj_9_alpha", 0),
    ]),
    (ti_on_presentation_run, [
        (store_trigger_param_1, ":var_0"),
        (set_fixed_point_multiplier, 1000),
        (presentation_set_duration, 1000000),
        (music_set_situation, 1024),
        (play_track, "track_02_Elven_Oratory_Valar_Glory", 2),
        (try_begin),
            (this_or_next|key_clicked, key_space),
            (this_or_next|key_clicked, key_enter),
            (this_or_next|key_clicked, key_escape),
            (this_or_next|key_clicked, key_back_space),
            (this_or_next|key_clicked, key_left_mouse_button),
            (key_clicked, key_right_mouse_button),
            (presentation_set_duration, 0),
        (try_end),
        (try_begin),
            (neg|ge, "$g_presentation_credits_obj_1", 0),
            (str_store_string, s1, "str_credits_1"),
            (create_text_overlay, "$g_presentation_credits_obj_1", 1, 6160),
            (overlay_set_color, "$g_presentation_credits_obj_1", 3224325),
            (overlay_set_alpha, "$g_presentation_credits_obj_1", 0),
            (position_set_x, pos1, 1500),
            (position_set_y, pos1, 1500),
            (overlay_set_size, "$g_presentation_credits_obj_1", pos1),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 375),
            (overlay_set_position, "$g_presentation_credits_obj_1", pos1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_1", 1000, 255),
        (else_try),
            (gt, ":var_0", 10000),
            (eq, "$g_presentation_credits_obj_1_alpha", 0),
            (assign, "$g_presentation_credits_obj_1_alpha", 1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_1", 1000, 0),
        (else_try),
            (gt, ":var_0", 12000),
            (neg|ge, "$g_presentation_credits_obj_2", 0),
            (str_store_string, s1, "str_credits_2"),
            (create_text_overlay, "$g_presentation_credits_obj_2", 1, 6160),
            (overlay_set_color, "$g_presentation_credits_obj_2", 1848095),
            (overlay_set_alpha, "$g_presentation_credits_obj_2", 0),
            (position_set_x, pos1, 1050),
            (position_set_y, pos1, 1050),
            (overlay_set_size, "$g_presentation_credits_obj_2", pos1),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 375),
            (overlay_set_position, "$g_presentation_credits_obj_2", pos1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_2", 1000, 255),
        (else_try),
            (gt, ":var_0", 22000),
            (eq, "$g_presentation_credits_obj_2_alpha", 0),
            (assign, "$g_presentation_credits_obj_2_alpha", 1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_2", 1000, 0),
        (else_try),
            (gt, ":var_0", 24000),
            (neg|ge, "$g_presentation_credits_obj_3", 0),
            (str_store_string, s1, "str_credits_3"),
            (create_text_overlay, "$g_presentation_credits_obj_3", 1, 6160),
            (overlay_set_color, "$g_presentation_credits_obj_3", 1451545),
            (overlay_set_alpha, "$g_presentation_credits_obj_3", 0),
            (position_set_x, pos1, 1050),
            (position_set_y, pos1, 1050),
            (overlay_set_size, "$g_presentation_credits_obj_3", pos1),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 375),
            (overlay_set_position, "$g_presentation_credits_obj_3", pos1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_3", 1000, 255),
        (else_try),
            (gt, ":var_0", 34000),
            (eq, "$g_presentation_credits_obj_3_alpha", 0),
            (assign, "$g_presentation_credits_obj_3_alpha", 1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_3", 1000, 0),
        (else_try),
            (gt, ":var_0", 36000),
            (neg|ge, "$g_presentation_credits_obj_4", 0),
            (str_store_string, s1, "str_credits_4"),
            (create_text_overlay, "$g_presentation_credits_obj_4", 1, 6160),
            (overlay_set_color, "$g_presentation_credits_obj_4", 0),
            (overlay_set_alpha, "$g_presentation_credits_obj_4", 0),
            (position_set_x, pos1, 1050),
            (position_set_y, pos1, 1050),
            (overlay_set_size, "$g_presentation_credits_obj_4", pos1),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 375),
            (overlay_set_position, "$g_presentation_credits_obj_4", pos1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_4", 1000, 255),
        (else_try),
            (gt, ":var_0", 46000),
            (eq, "$g_presentation_credits_obj_4_alpha", 0),
            (assign, "$g_presentation_credits_obj_4_alpha", 1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_4", 1000, 0),
        (else_try),
            (gt, ":var_0", 48000),
            (neg|ge, "$g_presentation_credits_obj_5", 0),
            (str_store_string, s1, "str_credits_5"),
            (create_text_overlay, "$g_presentation_credits_obj_5", 1, 6160),
            (overlay_set_color, "$g_presentation_credits_obj_5", 0),
            (overlay_set_alpha, "$g_presentation_credits_obj_5", 0),
            (position_set_x, pos1, 1050),
            (position_set_y, pos1, 1050),
            (overlay_set_size, "$g_presentation_credits_obj_5", pos1),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 375),
            (overlay_set_position, "$g_presentation_credits_obj_5", pos1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_5", 1000, 255),
        (else_try),
            (gt, ":var_0", 58000),
            (eq, "$g_presentation_credits_obj_5_alpha", 0),
            (assign, "$g_presentation_credits_obj_5_alpha", 1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_5", 1000, 0),
        (else_try),
            (gt, ":var_0", 60000),
            (neg|ge, "$g_presentation_credits_obj_6", 0),
            (str_store_string, s1, "str_credits_6"),
            (create_text_overlay, "$g_presentation_credits_obj_6", 1, 6160),
            (overlay_set_color, "$g_presentation_credits_obj_6", 0),
            (overlay_set_alpha, "$g_presentation_credits_obj_6", 0),
            (position_set_x, pos1, 1050),
            (position_set_y, pos1, 1050),
            (overlay_set_size, "$g_presentation_credits_obj_6", pos1),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 375),
            (overlay_set_position, "$g_presentation_credits_obj_6", pos1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_6", 1000, 255),
        (else_try),
            (gt, ":var_0", 70000),
            (eq, "$g_presentation_credits_obj_6_alpha", 0),
            (assign, "$g_presentation_credits_obj_6_alpha", 1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_6", 1000, 0),
        (else_try),
            (gt, ":var_0", 72000),
            (neg|ge, "$g_presentation_credits_obj_7", 0),
            (str_store_string, s1, "str_credits_7"),
            (create_text_overlay, "$g_presentation_credits_obj_7", 1, 6160),
            (overlay_set_color, "$g_presentation_credits_obj_7", 1848095),
            (overlay_set_alpha, "$g_presentation_credits_obj_7", 0),
            (position_set_x, pos1, 1050),
            (position_set_y, pos1, 1050),
            (overlay_set_size, "$g_presentation_credits_obj_7", pos1),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 375),
            (overlay_set_position, "$g_presentation_credits_obj_7", pos1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_7", 1000, 255),
        (else_try),
            (gt, ":var_0", 82000),
            (eq, "$g_presentation_credits_obj_7_alpha", 0),
            (assign, "$g_presentation_credits_obj_7_alpha", 1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_7", 1000, 0),
        (else_try),
            (gt, ":var_0", 84000),
            (neg|ge, "$g_presentation_credits_obj_8", 0),
            (str_store_string, s1, "str_credits_8"),
            (create_text_overlay, "$g_presentation_credits_obj_8", 1, 6160),
            (overlay_set_color, "$g_presentation_credits_obj_8", 0),
            (overlay_set_alpha, "$g_presentation_credits_obj_8", 0),
            (position_set_x, pos1, 1050),
            (position_set_y, pos1, 1050),
            (overlay_set_size, "$g_presentation_credits_obj_8", pos1),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 375),
            (overlay_set_position, "$g_presentation_credits_obj_8", pos1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_8", 1000, 255),
        (else_try),
            (gt, ":var_0", 94000),
            (eq, "$g_presentation_credits_obj_8_alpha", 0),
            (assign, "$g_presentation_credits_obj_8_alpha", 1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_8", 1000, 0),
        (else_try),
            (gt, ":var_0", 96000),
            (neg|ge, "$g_presentation_credits_obj_9", 0),
            (str_store_string, s1, "str_credits_10"),
            (create_text_overlay, "$g_presentation_credits_obj_9", 1, 6160),
            (overlay_set_color, "$g_presentation_credits_obj_9", 0),
            (overlay_set_alpha, "$g_presentation_credits_obj_9", 0),
            (position_set_x, pos1, 750),
            (position_set_y, pos1, 750),
            (overlay_set_size, "$g_presentation_credits_obj_9", pos1),
            (position_set_x, pos1, 250),
            (position_set_y, pos1, 485),
            (overlay_set_position, "$g_presentation_credits_obj_9", pos1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_9", 1000, 255),
            (str_store_string, s1, "str_credits_11"),
            (create_text_overlay, "$g_presentation_credits_obj_10", 1, 6160),
            (overlay_set_color, "$g_presentation_credits_obj_10", 0),
            (overlay_set_alpha, "$g_presentation_credits_obj_10", 0),
            (position_set_x, pos1, 750),
            (position_set_y, pos1, 750),
            (overlay_set_size, "$g_presentation_credits_obj_10", pos1),
            (position_set_x, pos1, 750),
            (position_set_y, pos1, 470),
            (overlay_set_position, "$g_presentation_credits_obj_10", pos1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_10", 1000, 255),
            (str_store_string, s1, "str_credits_12"),
            (create_text_overlay, "$g_presentation_credits_obj_11", 1, 6160),
            (overlay_set_color, "$g_presentation_credits_obj_11", 0),
            (overlay_set_alpha, "$g_presentation_credits_obj_11", 0),
            (position_set_x, pos1, 750),
            (position_set_y, pos1, 750),
            (overlay_set_size, "$g_presentation_credits_obj_11", pos1),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 105),
            (overlay_set_position, "$g_presentation_credits_obj_11", pos1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_11", 1000, 255),
        (else_try),
            (gt, ":var_0", 106000),
            (eq, "$g_presentation_credits_obj_9_alpha", 0),
            (assign, "$g_presentation_credits_obj_9_alpha", 1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_9", 1000, 0),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_10", 1000, 0),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_11", 1000, 0),
        (else_try),
            (gt, ":var_0", 107000),
            (neg|ge, "$g_presentation_credits_obj_12", 0),
            (str_store_string, s1, "str_credits_9"),
            (create_text_overlay, "$g_presentation_credits_obj_12", 1, 2064),
            (overlay_set_color, "$g_presentation_credits_obj_12", 0),
            (overlay_set_alpha, "$g_presentation_credits_obj_12", 255),
            (position_set_x, pos1, 950),
            (position_set_y, pos1, 950),
            (overlay_set_size, "$g_presentation_credits_obj_12", pos1),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, -4800),
            (overlay_set_position, "$g_presentation_credits_obj_12", pos1),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 760),
            (overlay_animate_to_position, "$g_presentation_credits_obj_12", 70000, pos1),
        (else_try),
            (gt, ":var_0", 262500),
            (presentation_set_duration, 0),
        (try_end),
    ]),
]),

("game_profile_banner_selection", 0, mesh_load_window, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (str_store_string, s1, "str_profile_banner_selection_text"),
        (create_text_overlay, reg1, 1, 16),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 600),
        (overlay_set_position, reg1, pos1),
        (overlay_set_text, reg1, 1),
        (create_button_overlay, "$g_presentation_obj_profile_banner_selection_1", "@Next Page", 16),
        (position_set_x, pos1, 700),
        (position_set_y, pos1, 50),
        (overlay_set_position, "$g_presentation_obj_profile_banner_selection_1", pos1),
        (create_button_overlay, "$g_presentation_obj_profile_banner_selection_2", "str_use_default_banner", 16),
        (position_set_x, pos1, 300),
        (position_set_y, pos1, 50),
        (overlay_set_position, "$g_presentation_obj_profile_banner_selection_2", pos1),
        (assign, ":var_0", 150),
        (assign, ":var_1", 575),
        (store_mul, ":var_2", 16, "$g_presentation_page_no"),
        (store_add, ":var_3", ":var_2", 16),
        (store_add, "$g_presentation_banner_start", "$g_presentation_obj_profile_banner_selection_2", 1),
        (assign, ":var_4", 0),
        (try_for_range, ":var_5", "mesh_banner_a01", "mesh_banner_f21"),
            (assign, ":var_6", 0),
            (try_for_range, ":var_7", "fac_kingdom_1", "fac_kingdoms_end"),
                (faction_slot_eq, ":var_7", slot_faction_banner, ":var_5"),
                (assign, ":var_6", 1),
            (try_end),
            (eq, ":var_6", 0),
            (val_add, ":var_4", 1),
            (gt, ":var_4", ":var_2"),
            (neg|gt, ":var_4", ":var_3"),
            (create_image_button_overlay, reg1, ":var_5", ":var_5"),
            (position_set_x, pos1, ":var_0"),
            (position_set_y, pos1, ":var_1"),
            (overlay_set_position, reg1, pos1),
            (position_set_x, pos1, 100),
            (position_set_y, pos1, 100),
            (overlay_set_size, reg1, pos1),
            (val_add, ":var_0", 100),
            (ge, ":var_0", 900),
            (assign, ":var_0", 150),
            (val_sub, ":var_1", 250),
        (try_end),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":var_0"),
        (try_begin),
            (eq, ":var_0", "$g_presentation_obj_profile_banner_selection_1"),
            (val_add, "$g_presentation_page_no", 1),
            (val_mod, "$g_presentation_page_no", 8),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_game_profile_banner_selection"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_profile_banner_selection_2"),
            (profile_set_banner_id, -1),
            (presentation_set_duration, 0),
        (else_try),
            (store_sub, ":var_1", ":var_0", "$g_presentation_banner_start"),
            (store_mul, ":var_2", 16, "$g_presentation_page_no"),
            (val_add, ":var_1", ":var_2"),
            (assign, ":var_3", 0),
            (assign, ":var_4", "mesh_banner_f21"),
            (try_for_range, ":var_5", "mesh_banner_a01", ":var_4"),
                (assign, ":var_6", 0),
                (try_for_range, ":var_7", "fac_kingdom_1", "fac_kingdoms_end"),
                    (faction_slot_eq, ":var_7", slot_faction_banner, ":var_5"),
                    (assign, ":var_6", 1),
                (try_end),
                (eq, ":var_6", 0),
                (try_begin),
                    (eq, ":var_1", ":var_3"),
                    (store_sub, ":var_8", ":var_5", "mesh_banner_a01"),
                    (profile_set_banner_id, ":var_8"),
                    (assign, ":var_4", 0),
                (try_end),
                (val_add, ":var_3", 1),
            (try_end),
            (presentation_set_duration, 0),
        (try_end),
    ]),
]),

("game_custom_battle_designer", prsntf_manual_end_only, mesh_cb_ui_main, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (create_text_overlay, reg0, "str_player", 98320),
        (overlay_set_color, reg0, 4294967295),
        (position_set_x, pos1, 1500),
        (position_set_y, pos1, 1500),
        (overlay_set_size, reg0, pos1),
        (position_set_x, pos1, 175),
        (position_set_y, pos1, 700),
        (overlay_set_position, reg0, pos1),
        (create_text_overlay, reg0, "str_enemy", 98320),
        (overlay_set_color, reg0, 4294967295),
        (position_set_x, pos1, 1500),
        (position_set_y, pos1, 1500),
        (overlay_set_size, reg0, pos1),
        (position_set_x, pos1, 820),
        (position_set_y, pos1, 700),
        (overlay_set_position, reg0, pos1),
        (create_text_overlay, reg0, "str_character", 16),
        (position_set_x, pos1, 175),
        (position_set_y, pos1, 670),
        (overlay_set_position, reg0, pos1),
        (create_combo_label_overlay, "$g_presentation_obj_custom_battle_designer_18"),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, "$g_presentation_obj_custom_battle_designer_18", pos1),
        (position_set_x, pos1, 175),
        (position_set_y, pos1, 635),
        (overlay_set_position, "$g_presentation_obj_custom_battle_designer_18", pos1),
        (try_for_range, ":var_0", "trp_quick_battle_troop_1", "trp_quick_battle_troops_end"),
            (str_store_troop_name, s0, ":var_0"),
            (overlay_add_item, "$g_presentation_obj_custom_battle_designer_18", 0),
        (try_end),
        (store_sub, ":var_0", "$g_quick_battle_troop", "trp_quick_battle_troop_1"),
        (overlay_set_val, "$g_presentation_obj_custom_battle_designer_18", ":var_0"),
        (store_mul, ":var_0", "$g_quick_battle_troop", 2),
        (create_mesh_overlay_with_tableau_material, reg0, -1, "tableau_game_party_window", ":var_0"),
        (position_set_x, pos1, 25),
        (position_set_y, pos1, 370),
        (overlay_set_position, reg0, pos1),
        (try_begin),
            (eq, "$g_quick_battle_team_2_faction", "fac_kingdom_1"),
            (assign, ":var_0", "trp_sarleon_knight"),
        (else_try),
            (eq, "$g_quick_battle_team_2_faction", "fac_kingdom_2"),
            (assign, ":var_0", "trp_rav_knight"),
        (else_try),
            (eq, "$g_quick_battle_team_2_faction", "fac_kingdom_3"),
            (assign, ":var_0", "trp_dshar_noble_cavalry"),
        (else_try),
            (eq, "$g_quick_battle_team_2_faction", "fac_kingdom_4"),
            (assign, ":var_0", "trp_fierd_huscarl"),
        (else_try),
            (eq, "$g_quick_battle_team_2_faction", "fac_kingdom_5"),
            (assign, ":var_0", "trp_empire_knight"),
        (else_try),
            (assign, ":var_0", "trp_sea_raider"),
        (try_end),
        (val_mul, ":var_0", 2),
        (create_mesh_overlay_with_tableau_material, reg0, -1, "tableau_game_party_window", ":var_0"),
        (position_set_x, pos1, 670),
        (position_set_y, pos1, 370),
        (overlay_set_position, reg0, pos1),
        (create_text_overlay, reg0, "str_biography", 16),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 700),
        (overlay_set_position, reg0, pos1),
        (store_sub, ":var_1", "$g_quick_battle_troop", "trp_quick_battle_troop_1"),
        (val_add, ":var_1", "str_quick_battle_troop_1"),
        (create_text_overlay, reg0, ":var_1", 8192),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 850),
        (overlay_set_size, reg0, pos1),
        (position_set_x, pos1, 320),
        (position_set_y, pos1, 560),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 360),
        (position_set_y, pos1, 130),
        (overlay_set_area_size, reg0, pos1),
        (create_text_overlay, reg0, "str_map_basic", 16),
        (overlay_set_color, reg0, 16777215),
        (position_set_x, pos1, 1500),
        (position_set_y, pos1, 1500),
        (overlay_set_size, reg0, pos1),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 450),
        (overlay_set_position, reg0, pos1),
        (create_combo_label_overlay, "$g_presentation_obj_custom_battle_designer_1"),
        (position_set_x, pos1, 700),
        (position_set_y, pos1, 700),
        (overlay_set_size, "$g_presentation_obj_custom_battle_designer_1", pos1),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 415),
        (overlay_set_position, "$g_presentation_obj_custom_battle_designer_1", pos1),
        (try_begin),
            (eq, "$g_quick_battle_game_type", 0),
            (try_for_range, ":var_2", "scn_quick_battle_scene_1", "scn_quick_battle_scene_4"),
                (store_sub, ":var_3", ":var_2", "scn_quick_battle_scene_1"),
                (val_add, ":var_3", "str_quick_battle_scene_1"),
                (overlay_add_item, "$g_presentation_obj_custom_battle_designer_1", ":var_3"),
            (try_end),
            (try_begin),
                (is_between, "$g_quick_battle_map", "scn_quick_battle_scene_1", "scn_quick_battle_scene_4"),
                (store_sub, ":var_4", "$g_quick_battle_map", "scn_quick_battle_scene_1"),
                (overlay_set_val, "$g_presentation_obj_custom_battle_designer_1", ":var_4"),
            (else_try),
                (overlay_set_val, "$g_presentation_obj_custom_battle_designer_1", 0),
                (assign, "$g_quick_battle_map", "scn_quick_battle_scene_1"),
            (try_end),
        (else_try),
            (try_for_range, ":var_2", "scn_quick_battle_scene_4", "scn_quick_battle_maps_end"),
                (store_sub, ":var_3", ":var_2", "scn_quick_battle_scene_1"),
                (val_add, ":var_3", "str_quick_battle_scene_1"),
                (overlay_add_item, "$g_presentation_obj_custom_battle_designer_1", ":var_3"),
            (try_end),
            (try_begin),
                (is_between, "$g_quick_battle_map", "scn_quick_battle_scene_4", "scn_quick_battle_maps_end"),
                (store_sub, ":var_4", "$g_quick_battle_map", "scn_quick_battle_scene_4"),
                (overlay_set_val, "$g_presentation_obj_custom_battle_designer_1", ":var_4"),
            (else_try),
                (overlay_set_val, "$g_presentation_obj_custom_battle_designer_1", 0),
                (assign, "$g_quick_battle_map", "scn_quick_battle_scene_4"),
            (try_end),
        (try_end),
        (store_sub, ":var_5", "$g_quick_battle_map", "scn_quick_battle_scene_1"),
        (val_add, ":var_5", "mesh_cb_ui_maps_scene_01"),
        (create_mesh_overlay, reg0, ":var_5"),
        (position_set_x, pos1, 700),
        (position_set_y, pos1, 700),
        (overlay_set_size, reg0, pos1),
        (position_set_x, pos1, 380),
        (position_set_y, pos1, 220),
        (overlay_set_position, reg0, pos1),
        (create_text_overlay, reg0, "str_game_type_basic", 16),
        (overlay_set_color, reg0, 16777215),
        (position_set_x, pos1, 1500),
        (position_set_y, pos1, 1500),
        (overlay_set_size, reg0, pos1),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 180),
        (overlay_set_position, reg0, pos1),
        (create_combo_label_overlay, "$g_presentation_obj_custom_battle_designer_23"),
        (position_set_x, pos1, 700),
        (position_set_y, pos1, 700),
        (overlay_set_size, "$g_presentation_obj_custom_battle_designer_23", pos1),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 150),
        (overlay_set_position, "$g_presentation_obj_custom_battle_designer_23", pos1),
        (overlay_add_item, "$g_presentation_obj_custom_battle_designer_23", "str_battle"),
        (overlay_add_item, "$g_presentation_obj_custom_battle_designer_23", "str_siege_offense"),
        (overlay_add_item, "$g_presentation_obj_custom_battle_designer_23", "str_siege_defense"),
        (overlay_set_val, "$g_presentation_obj_custom_battle_designer_23", "$g_quick_battle_game_type"),
        (create_game_button_overlay, "$g_presentation_obj_custom_battle_designer_24", "str_randomize"),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 60),
        (overlay_set_position, "$g_presentation_obj_custom_battle_designer_24", pos1),
        (assign, ":var_6", 330),
        (assign, ":var_6", 350),
        (assign, ":var_7", 40),
        (create_text_overlay, reg0, "str_faction", 16),
        (position_set_x, pos1, 175),
        (position_set_y, pos1, ":var_6"),
        (overlay_set_position, reg0, pos1),
        (create_text_overlay, reg0, "str_faction", 16),
        (position_set_x, pos1, 820),
        (position_set_y, pos1, ":var_6"),
        (overlay_set_position, reg0, pos1),
        (val_sub, ":var_6", ":var_7"),
        (create_combo_label_overlay, "$g_presentation_obj_custom_battle_designer_4"),
        (position_set_x, pos1, 175),
        (position_set_y, pos1, ":var_6"),
        (overlay_set_position, "$g_presentation_obj_custom_battle_designer_4", pos1),
        (try_begin),
            (is_trial_version),
            (str_store_faction_name, s0, "fac_kingdom_1"),
            (overlay_add_item, "$g_presentation_obj_custom_battle_designer_4", 0),
            (store_add, ":var_8", "fac_kingdom_1", 1),
            (str_store_faction_name, s0, ":var_8"),
            (overlay_add_item, "$g_presentation_obj_custom_battle_designer_4", 0),
        (else_try),
            (try_for_range, ":var_8", "fac_kingdom_1", "fac_kingdoms_end"),
                (str_store_faction_name, s0, ":var_8"),
                (overlay_add_item, "$g_presentation_obj_custom_battle_designer_4", 0),
            (try_end),
            (str_store_faction_name, s0, "fac_outlaws"),
            (overlay_add_item, "$g_presentation_obj_custom_battle_designer_4", 0),
        (try_end),
        (try_begin),
            (eq, "$g_quick_battle_team_1_faction", "fac_outlaws"),
            (store_sub, ":var_9", "fac_kingdoms_end", "fac_kingdom_1"),
            (overlay_set_val, "$g_presentation_obj_custom_battle_designer_4", ":var_9"),
        (else_try),
            (store_sub, ":var_10", "$g_quick_battle_team_1_faction", "fac_kingdom_1"),
            (overlay_set_val, "$g_presentation_obj_custom_battle_designer_4", ":var_10"),
        (try_end),
        (create_combo_label_overlay, "$g_presentation_obj_custom_battle_designer_5"),
        (position_set_x, pos1, 820),
        (position_set_y, pos1, ":var_6"),
        (overlay_set_position, "$g_presentation_obj_custom_battle_designer_5", pos1),
        (try_begin),
            (is_trial_version),
            (str_store_faction_name, s0, "fac_kingdom_1"),
            (overlay_add_item, "$g_presentation_obj_custom_battle_designer_5", 0),
            (store_add, ":var_8", "fac_kingdom_1", 1),
            (str_store_faction_name, s0, ":var_8"),
            (overlay_add_item, "$g_presentation_obj_custom_battle_designer_5", 0),
        (else_try),
            (try_for_range, ":var_8", "fac_kingdom_1", "fac_kingdoms_end"),
                (str_store_faction_name, s0, ":var_8"),
                (overlay_add_item, "$g_presentation_obj_custom_battle_designer_5", 0),
            (try_end),
            (str_store_faction_name, s0, "fac_outlaws"),
            (overlay_add_item, "$g_presentation_obj_custom_battle_designer_5", 0),
        (try_end),
        (try_begin),
            (eq, "$g_quick_battle_team_2_faction", "fac_outlaws"),
            (store_sub, ":var_9", "fac_kingdoms_end", "fac_kingdom_1"),
            (overlay_set_val, "$g_presentation_obj_custom_battle_designer_5", ":var_9"),
        (else_try),
            (store_sub, ":var_11", "$g_quick_battle_team_2_faction", "fac_kingdom_1"),
            (overlay_set_val, "$g_presentation_obj_custom_battle_designer_5", ":var_11"),
        (try_end),
        (val_sub, ":var_6", ":var_7"),
        (create_text_overlay, reg0, "str_army_composition", 16),
        (position_set_x, pos1, 175),
        (position_set_y, pos1, ":var_6"),
        (overlay_set_position, reg0, pos1),
        (create_text_overlay, reg0, "str_army_composition", 16),
        (position_set_x, pos1, 820),
        (position_set_y, pos1, ":var_6"),
        (overlay_set_position, reg0, pos1),
        (val_sub, ":var_6", ":var_7"),
        (try_begin),
            (eq, "$g_presentation_obj_custom_battle_designer_6_last_value", 0),
            (eq, "$g_presentation_obj_custom_battle_designer_7_last_value", 0),
            (eq, "$g_presentation_obj_custom_battle_designer_8_last_value", 0),
            (eq, "$g_presentation_obj_custom_battle_designer_9_last_value", 0),
            (eq, "$g_presentation_obj_custom_battle_designer_10_last_value", 0),
            (eq, "$g_presentation_obj_custom_battle_designer_11_last_value", 0),
            (assign, "$g_presentation_obj_custom_battle_designer_6_last_value", 34),
            (assign, "$g_presentation_obj_custom_battle_designer_7_last_value", 33),
            (assign, "$g_presentation_obj_custom_battle_designer_8_last_value", 33),
            (assign, "$g_presentation_obj_custom_battle_designer_9_last_value", 34),
            (assign, "$g_presentation_obj_custom_battle_designer_10_last_value", 33),
            (assign, "$g_presentation_obj_custom_battle_designer_11_last_value", 33),
            (assign, "$g_presentation_obj_custom_battle_designer_6_locked", 0),
            (assign, "$g_presentation_obj_custom_battle_designer_7_locked", 0),
            (assign, "$g_presentation_obj_custom_battle_designer_8_locked", 0),
            (assign, "$g_presentation_obj_custom_battle_designer_9_locked", 0),
            (assign, "$g_presentation_obj_custom_battle_designer_10_locked", 0),
            (assign, "$g_presentation_obj_custom_battle_designer_11_locked", 0),
        (try_end),
        (create_mesh_overlay, reg0, "mesh_cb_ui_icon_infantry"),
        (position_set_x, pos1, 5),
        (position_set_y, pos1, ":var_6"),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 400),
        (overlay_set_size, reg0, pos1),
        (create_mesh_overlay, reg0, "mesh_cb_ui_icon_infantry"),
        (position_set_x, pos1, 650),
        (position_set_y, pos1, ":var_6"),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 400),
        (overlay_set_size, reg0, pos1),
        (create_slider_overlay, "$g_presentation_obj_custom_battle_designer_6", 0, 100),
        (overlay_set_val, "$g_presentation_obj_custom_battle_designer_6", "$g_presentation_obj_custom_battle_designer_6_last_value"),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 1000),
        (overlay_set_size, "$g_presentation_obj_custom_battle_designer_6", pos1),
        (position_set_x, pos1, 175),
        (position_set_y, pos1, ":var_6"),
        (overlay_set_position, "$g_presentation_obj_custom_battle_designer_6", pos1),
        (assign, reg0, "$g_presentation_obj_custom_battle_designer_6_last_value"),
        (create_text_overlay, "$g_presentation_obj_custom_battle_designer_12", "str_reg0_percent", 0),
        (position_set_x, pos1, 295),
        (position_set_y, pos1, ":var_6"),
        (overlay_set_position, "$g_presentation_obj_custom_battle_designer_12", pos1),
        (create_slider_overlay, "$g_presentation_obj_custom_battle_designer_9", 0, 100),
        (overlay_set_val, "$g_presentation_obj_custom_battle_designer_9", "$g_presentation_obj_custom_battle_designer_9_last_value"),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 1000),
        (overlay_set_size, "$g_presentation_obj_custom_battle_designer_9", pos1),
        (position_set_x, pos1, 820),
        (position_set_y, pos1, ":var_6"),
        (overlay_set_position, "$g_presentation_obj_custom_battle_designer_9", pos1),
        (assign, reg0, "$g_presentation_obj_custom_battle_designer_9_last_value"),
        (create_text_overlay, "$g_presentation_obj_custom_battle_designer_15", "str_reg0_percent", 0),
        (position_set_x, pos1, 940),
        (position_set_y, pos1, ":var_6"),
        (overlay_set_position, "$g_presentation_obj_custom_battle_designer_15", pos1),
        (val_sub, ":var_6", ":var_7"),
        (create_mesh_overlay, reg0, "mesh_cb_ui_icon_archer"),
        (position_set_x, pos1, 15),
        (position_set_y, pos1, ":var_6"),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 400),
        (overlay_set_size, reg0, pos1),
        (create_mesh_overlay, reg0, "mesh_cb_ui_icon_archer"),
        (position_set_x, pos1, 660),
        (position_set_y, pos1, ":var_6"),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 400),
        (overlay_set_size, reg0, pos1),
        (create_slider_overlay, "$g_presentation_obj_custom_battle_designer_7", 0, 100),
        (overlay_set_val, "$g_presentation_obj_custom_battle_designer_7", "$g_presentation_obj_custom_battle_designer_7_last_value"),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 1000),
        (overlay_set_size, "$g_presentation_obj_custom_battle_designer_7", pos1),
        (position_set_x, pos1, 175),
        (position_set_y, pos1, ":var_6"),
        (overlay_set_position, "$g_presentation_obj_custom_battle_designer_7", pos1),
        (assign, reg0, "$g_presentation_obj_custom_battle_designer_7_last_value"),
        (create_text_overlay, "$g_presentation_obj_custom_battle_designer_13", "str_reg0_percent", 0),
        (position_set_x, pos1, 295),
        (position_set_y, pos1, ":var_6"),
        (overlay_set_position, "$g_presentation_obj_custom_battle_designer_13", pos1),
        (create_slider_overlay, "$g_presentation_obj_custom_battle_designer_10", 0, 100),
        (overlay_set_val, "$g_presentation_obj_custom_battle_designer_10", "$g_presentation_obj_custom_battle_designer_10_last_value"),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 1000),
        (overlay_set_size, "$g_presentation_obj_custom_battle_designer_10", pos1),
        (position_set_x, pos1, 820),
        (position_set_y, pos1, ":var_6"),
        (overlay_set_position, "$g_presentation_obj_custom_battle_designer_10", pos1),
        (assign, reg0, "$g_presentation_obj_custom_battle_designer_10_last_value"),
        (create_text_overlay, "$g_presentation_obj_custom_battle_designer_16", "str_reg0_percent", 0),
        (position_set_x, pos1, 940),
        (position_set_y, pos1, ":var_6"),
        (overlay_set_position, "$g_presentation_obj_custom_battle_designer_16", pos1),
        (val_sub, ":var_6", ":var_7"),
        (create_mesh_overlay, reg0, "mesh_cb_ui_icon_horseman"),
        (position_set_x, pos1, 10),
        (position_set_y, pos1, ":var_6"),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 400),
        (overlay_set_size, reg0, pos1),
        (create_mesh_overlay, reg0, "mesh_cb_ui_icon_horseman"),
        (position_set_x, pos1, 655),
        (position_set_y, pos1, ":var_6"),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 400),
        (overlay_set_size, reg0, pos1),
        (create_slider_overlay, "$g_presentation_obj_custom_battle_designer_8", 0, 100),
        (overlay_set_val, "$g_presentation_obj_custom_battle_designer_8", "$g_presentation_obj_custom_battle_designer_8_last_value"),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 1000),
        (overlay_set_size, "$g_presentation_obj_custom_battle_designer_8", pos1),
        (position_set_x, pos1, 175),
        (position_set_y, pos1, ":var_6"),
        (overlay_set_position, "$g_presentation_obj_custom_battle_designer_8", pos1),
        (assign, reg0, "$g_presentation_obj_custom_battle_designer_8_last_value"),
        (create_text_overlay, "$g_presentation_obj_custom_battle_designer_14", "str_reg0_percent", 0),
        (position_set_x, pos1, 295),
        (position_set_y, pos1, ":var_6"),
        (overlay_set_position, "$g_presentation_obj_custom_battle_designer_14", pos1),
        (create_slider_overlay, "$g_presentation_obj_custom_battle_designer_11", 0, 100),
        (overlay_set_val, "$g_presentation_obj_custom_battle_designer_11", "$g_presentation_obj_custom_battle_designer_11_last_value"),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 1000),
        (overlay_set_size, "$g_presentation_obj_custom_battle_designer_11", pos1),
        (position_set_x, pos1, 820),
        (position_set_y, pos1, ":var_6"),
        (overlay_set_position, "$g_presentation_obj_custom_battle_designer_11", pos1),
        (assign, reg0, "$g_presentation_obj_custom_battle_designer_11_last_value"),
        (create_text_overlay, "$g_presentation_obj_custom_battle_designer_17", "str_reg0_percent", 0),
        (position_set_x, pos1, 940),
        (position_set_y, pos1, ":var_6"),
        (overlay_set_position, "$g_presentation_obj_custom_battle_designer_17", pos1),
        (val_sub, ":var_6", ":var_7"),
        (create_text_overlay, reg0, "str_army_size", 16),
        (position_set_x, pos1, 175),
        (position_set_y, pos1, ":var_6"),
        (overlay_set_position, reg0, pos1),
        (create_text_overlay, reg0, "str_army_size", 16),
        (position_set_x, pos1, 820),
        (position_set_y, pos1, ":var_6"),
        (overlay_set_position, reg0, pos1),
        (val_sub, ":var_6", ":var_7"),
        (try_begin),
            (is_trial_version),
            (val_min, "$g_quick_battle_army_1_size", 25),
            (val_min, "$g_quick_battle_army_2_size", 25),
        (try_end),
        (create_slider_overlay, "$g_presentation_obj_custom_battle_designer_2", 0, 100),
        (overlay_set_boundaries, "$g_presentation_obj_custom_battle_designer_2", 1000, 75000),
        (overlay_set_val, "$g_presentation_obj_custom_battle_designer_2", "$g_quick_battle_army_1_size"),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 1000),
        (overlay_set_size, "$g_presentation_obj_custom_battle_designer_2", pos1),
        (position_set_x, pos1, 135),
        (position_set_y, pos1, ":var_6"),
        (overlay_set_position, "$g_presentation_obj_custom_battle_designer_2", pos1),
        (call_script, "script_get_army_size_from_slider_value", "$g_quick_battle_army_1_size"),
        (create_text_overlay, "$g_presentation_obj_custom_battle_designer_21", "str_reg0_men", 0),
        (position_set_x, pos1, 255),
        (position_set_y, pos1, ":var_6"),
        (overlay_set_position, "$g_presentation_obj_custom_battle_designer_21", pos1),
        (create_slider_overlay, "$g_presentation_obj_custom_battle_designer_3", 200),
        (overlay_set_boundaries, "$g_presentation_obj_custom_battle_designer_3", 1000, 75000),
        (overlay_set_val, "$g_presentation_obj_custom_battle_designer_3", "$g_quick_battle_army_2_size"),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 1000),
        (overlay_set_size, "$g_presentation_obj_custom_battle_designer_3", pos1),
        (position_set_x, pos1, 780),
        (position_set_y, pos1, ":var_6"),
        (overlay_set_position, "$g_presentation_obj_custom_battle_designer_3", pos1),
        (call_script, "script_get_army_size_from_slider_value", "$g_quick_battle_army_2_size"),
        (create_text_overlay, "$g_presentation_obj_custom_battle_designer_22", "str_reg0_men", 0),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, ":var_6"),
        (overlay_set_position, "$g_presentation_obj_custom_battle_designer_22", pos1),
        (create_game_button_overlay, "$g_presentation_obj_custom_battle_designer_19", "str_start", 0),
        (position_set_x, pos1, 415),
        (position_set_y, pos1, 10),
        (overlay_set_position, "$g_presentation_obj_custom_battle_designer_19", pos1),
        (create_game_button_overlay, "$g_presentation_obj_custom_battle_designer_20", "str_back", 0),
        (position_set_x, pos1, 585),
        (position_set_y, pos1, 10),
        (overlay_set_position, "$g_presentation_obj_custom_battle_designer_20", pos1),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":var_0"),
        (store_trigger_param_2, ":var_1"),
        (try_begin),
            (eq, ":var_0", "$g_presentation_obj_custom_battle_designer_1"),
            (try_begin),
                (eq, "$g_quick_battle_game_type", 0),
                (store_add, "$g_quick_battle_map", ":var_1", "scn_quick_battle_scene_1"),
            (else_try),
                (store_add, "$g_quick_battle_map", ":var_1", "scn_quick_battle_scene_4"),
            (try_end),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_game_custom_battle_designer"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_custom_battle_designer_23"),
            (assign, "$g_quick_battle_game_type", ":var_1"),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_game_custom_battle_designer"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_custom_battle_designer_24"),
            (store_random_in_range, "$g_quick_battle_game_type", 0, 3),
            (store_random_in_range, "$g_quick_battle_troop", "trp_quick_battle_troop_1", "trp_quick_battle_troops_end"),
            (try_begin),
                (is_trial_version),
                (store_random_in_range, "$g_quick_battle_team_1_faction", 0, 2),
                (try_begin),
                    (eq, "$g_quick_battle_team_1_faction", 0),
                    (assign, "$g_quick_battle_team_2_faction", 1),
                (else_try),
                    (assign, "$g_quick_battle_team_2_faction", 0),
                (try_end),
                (val_add, "$g_quick_battle_team_1_faction", "fac_kingdom_1"),
                (val_add, "$g_quick_battle_team_2_faction", "fac_kingdom_1"),
                (store_random_in_range, "$g_quick_battle_army_1_size", 10, 16),
                (store_random_in_range, ":var_2", 0, 6),
                (val_add, "$g_quick_battle_army_1_size", ":var_2"),
                (store_random_in_range, ":var_2", 0, 6),
                (val_add, "$g_quick_battle_army_1_size", ":var_2"),
            (else_try),
                (store_sub, ":var_3", "fac_kingdoms_end", "fac_kingdom_1"),
                (val_add, ":var_3", 1),
                (store_random_in_range, "$g_quick_battle_team_1_faction", 0, ":var_3"),
                (try_begin),
                    (eq, "$g_quick_battle_team_1_faction", 0),
                    (assign, "$g_quick_battle_team_1_faction", "fac_outlaws"),
                (else_try),
                    (val_add, "$g_quick_battle_team_1_faction", "fac_kingdom_1"),
                    (val_sub, "$g_quick_battle_team_1_faction", 1),
                (try_end),
                (assign, ":var_4", 1000),
                (try_for_range, ":var_5", 0, ":var_4"),
                    (store_random_in_range, "$g_quick_battle_team_2_faction", 0, ":var_3"),
                    (try_begin),
                        (eq, "$g_quick_battle_team_2_faction", 0),
                        (assign, "$g_quick_battle_team_2_faction", "fac_outlaws"),
                    (else_try),
                        (val_add, "$g_quick_battle_team_2_faction", "fac_kingdom_1"),
                        (val_sub, "$g_quick_battle_team_2_faction", 1),
                    (try_end),
                    (neg|eq, "$g_quick_battle_team_1_faction", "$g_quick_battle_team_2_faction"),
                    (assign, ":var_4", 0),
                (try_end),
                (store_random_in_range, "$g_quick_battle_army_1_size", 10, 21),
                (store_random_in_range, ":var_2", 0, 11),
                (val_add, "$g_quick_battle_army_1_size", ":var_2"),
                (store_random_in_range, ":var_2", 0, 11),
                (val_add, "$g_quick_battle_army_1_size", ":var_2"),
            (try_end),
            (assign, "$g_quick_battle_army_2_size", "$g_quick_battle_army_1_size"),
            (try_begin),
                (eq, "$g_quick_battle_game_type", 0),
                (store_random_in_range, "$g_quick_battle_map", "scn_quick_battle_scene_1", "scn_quick_battle_scene_4"),
                (store_random_in_range, ":var_6", 0, 3),
                (store_random_in_range, ":var_7", 0, 2),
                (store_random_in_range, ":var_8", 0, 100),
                (store_sub, ":var_9", 100, ":var_8"),
                (store_random_in_range, ":var_10", 0, ":var_9"),
                (store_sub, ":var_11", ":var_9", ":var_10"),
                (try_begin),
                    (eq, ":var_6", 0),
                    (assign, "$g_presentation_obj_custom_battle_designer_6_last_value", ":var_8"),
                    (try_begin),
                        (eq, ":var_7", 0),
                        (assign, "$g_presentation_obj_custom_battle_designer_7_last_value", ":var_10"),
                        (assign, "$g_presentation_obj_custom_battle_designer_8_last_value", ":var_11"),
                    (else_try),
                        (assign, "$g_presentation_obj_custom_battle_designer_8_last_value", ":var_10"),
                        (assign, "$g_presentation_obj_custom_battle_designer_7_last_value", ":var_11"),
                    (try_end),
                (else_try),
                    (eq, ":var_6", 1),
                    (assign, "$g_presentation_obj_custom_battle_designer_7_last_value", ":var_8"),
                    (try_begin),
                        (eq, ":var_7", 0),
                        (assign, "$g_presentation_obj_custom_battle_designer_6_last_value", ":var_10"),
                        (assign, "$g_presentation_obj_custom_battle_designer_8_last_value", ":var_11"),
                    (else_try),
                        (assign, "$g_presentation_obj_custom_battle_designer_8_last_value", ":var_10"),
                        (assign, "$g_presentation_obj_custom_battle_designer_6_last_value", ":var_11"),
                    (try_end),
                (else_try),
                    (assign, "$g_presentation_obj_custom_battle_designer_8_last_value", ":var_8"),
                    (try_begin),
                        (eq, ":var_7", 0),
                        (assign, "$g_presentation_obj_custom_battle_designer_6_last_value", ":var_10"),
                        (assign, "$g_presentation_obj_custom_battle_designer_7_last_value", ":var_11"),
                    (else_try),
                        (assign, "$g_presentation_obj_custom_battle_designer_7_last_value", ":var_10"),
                        (assign, "$g_presentation_obj_custom_battle_designer_6_last_value", ":var_11"),
                    (try_end),
                (try_end),
                (store_random_in_range, ":var_6", 0, 3),
                (store_random_in_range, ":var_7", 0, 2),
                (store_random_in_range, ":var_8", 0, 100),
                (store_sub, ":var_9", 100, ":var_8"),
                (store_random_in_range, ":var_10", 0, ":var_9"),
                (store_sub, ":var_11", ":var_9", ":var_10"),
                (try_begin),
                    (eq, ":var_6", 0),
                    (assign, "$g_presentation_obj_custom_battle_designer_9_last_value", ":var_8"),
                    (try_begin),
                        (eq, ":var_7", 0),
                        (assign, "$g_presentation_obj_custom_battle_designer_10_last_value", ":var_10"),
                        (assign, "$g_presentation_obj_custom_battle_designer_11_last_value", ":var_11"),
                    (else_try),
                        (assign, "$g_presentation_obj_custom_battle_designer_11_last_value", ":var_10"),
                        (assign, "$g_presentation_obj_custom_battle_designer_10_last_value", ":var_11"),
                    (try_end),
                (else_try),
                    (eq, ":var_6", 1),
                    (assign, "$g_presentation_obj_custom_battle_designer_10_last_value", ":var_8"),
                    (try_begin),
                        (eq, ":var_7", 0),
                        (assign, "$g_presentation_obj_custom_battle_designer_9_last_value", ":var_10"),
                        (assign, "$g_presentation_obj_custom_battle_designer_11_last_value", ":var_11"),
                    (else_try),
                        (assign, "$g_presentation_obj_custom_battle_designer_11_last_value", ":var_10"),
                        (assign, "$g_presentation_obj_custom_battle_designer_9_last_value", ":var_11"),
                    (try_end),
                (else_try),
                    (assign, "$g_presentation_obj_custom_battle_designer_11_last_value", ":var_8"),
                    (try_begin),
                        (eq, ":var_7", 0),
                        (assign, "$g_presentation_obj_custom_battle_designer_9_last_value", ":var_10"),
                        (assign, "$g_presentation_obj_custom_battle_designer_10_last_value", ":var_11"),
                    (else_try),
                        (assign, "$g_presentation_obj_custom_battle_designer_10_last_value", ":var_10"),
                        (assign, "$g_presentation_obj_custom_battle_designer_9_last_value", ":var_11"),
                    (try_end),
                (try_end),
            (else_try),
                (eq, "$g_quick_battle_game_type", 1),
                (store_random_in_range, "$g_quick_battle_map", "scn_quick_battle_scene_4", "scn_quick_battle_maps_end"),
                (store_random_in_range, "$g_presentation_obj_custom_battle_designer_10_last_value", 30, 100),
                (store_sub, "$g_presentation_obj_custom_battle_designer_9_last_value", 100, "$g_presentation_obj_custom_battle_designer_10_last_value"),
                (assign, "$g_presentation_obj_custom_battle_designer_11_last_value", 0),
                (store_random_in_range, "$g_presentation_obj_custom_battle_designer_6_last_value", 20, 100),
                (store_sub, "$g_presentation_obj_custom_battle_designer_7_last_value", 100, "$g_presentation_obj_custom_battle_designer_6_last_value"),
                (assign, "$g_presentation_obj_custom_battle_designer_8_last_value", 0),
            (else_try),
                (store_random_in_range, "$g_quick_battle_map", "scn_quick_battle_scene_4", "scn_quick_battle_maps_end"),
                (store_random_in_range, "$g_presentation_obj_custom_battle_designer_7_last_value", 30, 100),
                (store_sub, "$g_presentation_obj_custom_battle_designer_6_last_value", 100, "$g_presentation_obj_custom_battle_designer_7_last_value"),
                (assign, "$g_presentation_obj_custom_battle_designer_8_last_value", 0),
                (store_random_in_range, "$g_presentation_obj_custom_battle_designer_9_last_value", 20, 100),
                (store_sub, "$g_presentation_obj_custom_battle_designer_10_last_value", 100, "$g_presentation_obj_custom_battle_designer_9_last_value"),
                (assign, "$g_presentation_obj_custom_battle_designer_11_last_value", 0),
            (try_end),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_game_custom_battle_designer"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_custom_battle_designer_2"),
            (assign, "$g_quick_battle_army_1_size", ":var_1"),
            (try_begin),
                (is_trial_version),
                (gt, "$g_quick_battle_army_1_size", 25),
                (assign, "$g_quick_battle_army_1_size", 25),
                (overlay_set_val, "$g_presentation_obj_custom_battle_designer_2", 25),
            (try_end),
            (call_script, "script_get_army_size_from_slider_value", "$g_quick_battle_army_1_size"),
            (overlay_set_text, "$g_presentation_obj_custom_battle_designer_21", "str_reg0_men"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_custom_battle_designer_3"),
            (assign, "$g_quick_battle_army_2_size", ":var_1"),
            (try_begin),
                (is_trial_version),
                (gt, "$g_quick_battle_army_2_size", 25),
                (assign, "$g_quick_battle_army_2_size", 25),
                (overlay_set_val, "$g_presentation_obj_custom_battle_designer_3", 25),
            (try_end),
            (call_script, "script_get_army_size_from_slider_value", "$g_quick_battle_army_2_size"),
            (overlay_set_text, "$g_presentation_obj_custom_battle_designer_22", "str_reg0_men"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_custom_battle_designer_4"),
            (try_begin),
                (store_sub, ":var_12", "fac_kingdoms_end", "fac_kingdom_1"),
                (eq, ":var_1", ":var_12"),
                (assign, "$g_quick_battle_team_1_faction", "fac_outlaws"),
            (else_try),
                (store_add, "$g_quick_battle_team_1_faction", ":var_1", "fac_kingdom_1"),
            (try_end),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_custom_battle_designer_5"),
            (try_begin),
                (store_sub, ":var_12", "fac_kingdoms_end", "fac_kingdom_1"),
                (eq, ":var_1", ":var_12"),
                (assign, "$g_quick_battle_team_2_faction", "fac_outlaws"),
            (else_try),
                (store_add, "$g_quick_battle_team_2_faction", ":var_1", "fac_kingdom_1"),
            (try_end),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_game_custom_battle_designer"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_custom_battle_designer_18"),
            (store_add, "$g_quick_battle_troop", ":var_1", "trp_quick_battle_troop_1"),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_game_custom_battle_designer"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_custom_battle_designer_6"),
            (try_begin),
                (eq, "$g_presentation_obj_custom_battle_designer_6_locked", 1),
                (neg|eq, ":var_1", "$g_presentation_obj_custom_battle_designer_6_last_value"),
                (overlay_set_val, "$g_presentation_obj_custom_battle_designer_6", "$g_presentation_obj_custom_battle_designer_6_last_value"),
            (else_try),
                (try_begin),
                    (neg|ge, ":var_1", "$g_presentation_obj_custom_battle_designer_6_last_value"),
                    (store_sub, ":var_13", "$g_presentation_obj_custom_battle_designer_6_last_value", ":var_1"),
                    (try_begin),
                        (eq, "$g_presentation_obj_custom_battle_designer_7_locked", 1),
                        (assign, ":var_14", 0),
                        (assign, ":var_15", ":var_13"),
                    (else_try),
                        (eq, "$g_presentation_obj_custom_battle_designer_8_locked", 1),
                        (assign, ":var_14", ":var_13"),
                        (assign, ":var_15", 0),
                    (else_try),
                        (store_div, ":var_14", ":var_13", 2),
                        (store_sub, ":var_15", ":var_13", ":var_14"),
                        (try_begin),
                            (neg|eq, ":var_14", ":var_15"),
                            (store_random_in_range, ":var_16", 0, 2),
                            (eq, ":var_16", 0),
                            (val_sub, ":var_15", 1),
                            (val_add, ":var_14", 1),
                        (try_end),
                    (try_end),
                    (assign, "$g_presentation_obj_custom_battle_designer_6_last_value", ":var_1"),
                    (val_add, "$g_presentation_obj_custom_battle_designer_7_last_value", ":var_14"),
                    (val_add, "$g_presentation_obj_custom_battle_designer_8_last_value", ":var_15"),
                    (try_begin),
                        (gt, "$g_presentation_obj_custom_battle_designer_7_last_value", 100),
                        (store_sub, ":var_13", "$g_presentation_obj_custom_battle_designer_7_last_value", 100),
                        (val_add, "$g_presentation_obj_custom_battle_designer_8_last_value", ":var_13"),
                        (assign, "$g_presentation_obj_custom_battle_designer_7_last_value", 100),
                    (else_try),
                        (gt, "$g_presentation_obj_custom_battle_designer_8_last_value", 100),
                        (store_sub, ":var_13", "$g_presentation_obj_custom_battle_designer_8_last_value", 100),
                        (val_add, "$g_presentation_obj_custom_battle_designer_7_last_value", ":var_13"),
                        (assign, "$g_presentation_obj_custom_battle_designer_8_last_value", 100),
                    (try_end),
                    (overlay_set_val, "$g_presentation_obj_custom_battle_designer_7", "$g_presentation_obj_custom_battle_designer_7_last_value"),
                    (overlay_set_val, "$g_presentation_obj_custom_battle_designer_8", "$g_presentation_obj_custom_battle_designer_8_last_value"),
                (else_try),
                    (gt, ":var_1", "$g_presentation_obj_custom_battle_designer_6_last_value"),
                    (store_sub, ":var_13", ":var_1", "$g_presentation_obj_custom_battle_designer_6_last_value"),
                    (try_begin),
                        (eq, "$g_presentation_obj_custom_battle_designer_7_locked", 1),
                        (assign, ":var_14", 0),
                        (assign, ":var_15", ":var_13"),
                    (else_try),
                        (eq, "$g_presentation_obj_custom_battle_designer_8_locked", 1),
                        (assign, ":var_14", ":var_13"),
                        (assign, ":var_15", 0),
                    (else_try),
                        (store_div, ":var_14", ":var_13", 2),
                        (store_sub, ":var_15", ":var_13", ":var_14"),
                        (try_begin),
                            (neg|eq, ":var_14", ":var_15"),
                            (store_random_in_range, ":var_16", 0, 2),
                            (eq, ":var_16", 0),
                            (val_sub, ":var_15", 1),
                            (val_add, ":var_14", 1),
                        (try_end),
                    (try_end),
                    (assign, "$g_presentation_obj_custom_battle_designer_6_last_value", ":var_1"),
                    (val_sub, "$g_presentation_obj_custom_battle_designer_7_last_value", ":var_14"),
                    (val_sub, "$g_presentation_obj_custom_battle_designer_8_last_value", ":var_15"),
                    (try_begin),
                        (neg|ge, "$g_presentation_obj_custom_battle_designer_7_last_value", 0),
                        (val_add, "$g_presentation_obj_custom_battle_designer_8_last_value", "$g_presentation_obj_custom_battle_designer_7_last_value"),
                        (assign, "$g_presentation_obj_custom_battle_designer_7_last_value", 0),
                    (else_try),
                        (neg|ge, "$g_presentation_obj_custom_battle_designer_8_last_value", 0),
                        (val_add, "$g_presentation_obj_custom_battle_designer_7_last_value", "$g_presentation_obj_custom_battle_designer_8_last_value"),
                        (assign, "$g_presentation_obj_custom_battle_designer_8_last_value", 0),
                    (try_end),
                    (overlay_set_val, "$g_presentation_obj_custom_battle_designer_7", "$g_presentation_obj_custom_battle_designer_7_last_value"),
                    (overlay_set_val, "$g_presentation_obj_custom_battle_designer_8", "$g_presentation_obj_custom_battle_designer_8_last_value"),
                (try_end),
                (assign, reg0, "$g_presentation_obj_custom_battle_designer_6_last_value"),
                (overlay_set_text, "$g_presentation_obj_custom_battle_designer_12", "str_reg0_percent"),
                (assign, reg0, "$g_presentation_obj_custom_battle_designer_7_last_value"),
                (overlay_set_text, "$g_presentation_obj_custom_battle_designer_13", "str_reg0_percent"),
                (assign, reg0, "$g_presentation_obj_custom_battle_designer_8_last_value"),
                (overlay_set_text, "$g_presentation_obj_custom_battle_designer_14", "str_reg0_percent"),
            (try_end),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_custom_battle_designer_7"),
            (try_begin),
                (eq, "$g_presentation_obj_custom_battle_designer_7_locked", 1),
                (neg|eq, ":var_1", "$g_presentation_obj_custom_battle_designer_7_last_value"),
                (overlay_set_val, "$g_presentation_obj_custom_battle_designer_7", "$g_presentation_obj_custom_battle_designer_7_last_value"),
            (else_try),
                (try_begin),
                    (neg|ge, ":var_1", "$g_presentation_obj_custom_battle_designer_7_last_value"),
                    (store_sub, ":var_13", "$g_presentation_obj_custom_battle_designer_7_last_value", ":var_1"),
                    (try_begin),
                        (eq, "$g_presentation_obj_custom_battle_designer_6_locked", 1),
                        (assign, ":var_14", 0),
                        (assign, ":var_15", ":var_13"),
                    (else_try),
                        (eq, "$g_presentation_obj_custom_battle_designer_8_locked", 1),
                        (assign, ":var_14", ":var_13"),
                        (assign, ":var_15", 0),
                    (else_try),
                        (store_div, ":var_14", ":var_13", 2),
                        (store_sub, ":var_15", ":var_13", ":var_14"),
                        (try_begin),
                            (neg|eq, ":var_14", ":var_15"),
                            (store_random_in_range, ":var_16", 0, 2),
                            (eq, ":var_16", 0),
                            (val_sub, ":var_15", 1),
                            (val_add, ":var_14", 1),
                        (try_end),
                    (try_end),
                    (assign, "$g_presentation_obj_custom_battle_designer_7_last_value", ":var_1"),
                    (val_add, "$g_presentation_obj_custom_battle_designer_6_last_value", ":var_14"),
                    (val_add, "$g_presentation_obj_custom_battle_designer_8_last_value", ":var_15"),
                    (try_begin),
                        (gt, "$g_presentation_obj_custom_battle_designer_6_last_value", 100),
                        (store_sub, ":var_13", "$g_presentation_obj_custom_battle_designer_6_last_value", 100),
                        (val_add, "$g_presentation_obj_custom_battle_designer_8_last_value", ":var_13"),
                        (assign, "$g_presentation_obj_custom_battle_designer_6_last_value", 100),
                    (else_try),
                        (gt, "$g_presentation_obj_custom_battle_designer_8_last_value", 100),
                        (store_sub, ":var_13", "$g_presentation_obj_custom_battle_designer_8_last_value", 100),
                        (val_add, "$g_presentation_obj_custom_battle_designer_6_last_value", ":var_13"),
                        (assign, "$g_presentation_obj_custom_battle_designer_8_last_value", 100),
                    (try_end),
                    (overlay_set_val, "$g_presentation_obj_custom_battle_designer_6", "$g_presentation_obj_custom_battle_designer_6_last_value"),
                    (overlay_set_val, "$g_presentation_obj_custom_battle_designer_8", "$g_presentation_obj_custom_battle_designer_8_last_value"),
                (else_try),
                    (gt, ":var_1", "$g_presentation_obj_custom_battle_designer_7_last_value"),
                    (store_sub, ":var_13", ":var_1", "$g_presentation_obj_custom_battle_designer_7_last_value"),
                    (try_begin),
                        (eq, "$g_presentation_obj_custom_battle_designer_6_locked", 1),
                        (assign, ":var_14", 0),
                        (assign, ":var_15", ":var_13"),
                    (else_try),
                        (eq, "$g_presentation_obj_custom_battle_designer_8_locked", 1),
                        (assign, ":var_14", ":var_13"),
                        (assign, ":var_15", 0),
                    (else_try),
                        (store_div, ":var_14", ":var_13", 2),
                        (store_sub, ":var_15", ":var_13", ":var_14"),
                        (try_begin),
                            (neg|eq, ":var_14", ":var_15"),
                            (store_random_in_range, ":var_16", 0, 2),
                            (eq, ":var_16", 0),
                            (val_sub, ":var_15", 1),
                            (val_add, ":var_14", 1),
                        (try_end),
                    (try_end),
                    (assign, "$g_presentation_obj_custom_battle_designer_7_last_value", ":var_1"),
                    (val_sub, "$g_presentation_obj_custom_battle_designer_6_last_value", ":var_14"),
                    (val_sub, "$g_presentation_obj_custom_battle_designer_8_last_value", ":var_15"),
                    (try_begin),
                        (neg|ge, "$g_presentation_obj_custom_battle_designer_6_last_value", 0),
                        (val_add, "$g_presentation_obj_custom_battle_designer_8_last_value", "$g_presentation_obj_custom_battle_designer_6_last_value"),
                        (assign, "$g_presentation_obj_custom_battle_designer_6_last_value", 0),
                    (else_try),
                        (neg|ge, "$g_presentation_obj_custom_battle_designer_8_last_value", 0),
                        (val_add, "$g_presentation_obj_custom_battle_designer_6_last_value", "$g_presentation_obj_custom_battle_designer_8_last_value"),
                        (assign, "$g_presentation_obj_custom_battle_designer_8_last_value", 0),
                    (try_end),
                    (overlay_set_val, "$g_presentation_obj_custom_battle_designer_6", "$g_presentation_obj_custom_battle_designer_6_last_value"),
                    (overlay_set_val, "$g_presentation_obj_custom_battle_designer_8", "$g_presentation_obj_custom_battle_designer_8_last_value"),
                (try_end),
                (assign, reg0, "$g_presentation_obj_custom_battle_designer_6_last_value"),
                (overlay_set_text, "$g_presentation_obj_custom_battle_designer_12", "str_reg0_percent"),
                (assign, reg0, "$g_presentation_obj_custom_battle_designer_7_last_value"),
                (overlay_set_text, "$g_presentation_obj_custom_battle_designer_13", "str_reg0_percent"),
                (assign, reg0, "$g_presentation_obj_custom_battle_designer_8_last_value"),
                (overlay_set_text, "$g_presentation_obj_custom_battle_designer_14", "str_reg0_percent"),
            (try_end),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_custom_battle_designer_8"),
            (try_begin),
                (eq, "$g_presentation_obj_custom_battle_designer_8_locked", 1),
                (neg|eq, ":var_1", "$g_presentation_obj_custom_battle_designer_8_last_value"),
                (overlay_set_val, "$g_presentation_obj_custom_battle_designer_8", "$g_presentation_obj_custom_battle_designer_8_last_value"),
            (else_try),
                (try_begin),
                    (neg|ge, ":var_1", "$g_presentation_obj_custom_battle_designer_8_last_value"),
                    (store_sub, ":var_13", "$g_presentation_obj_custom_battle_designer_8_last_value", ":var_1"),
                    (try_begin),
                        (eq, "$g_presentation_obj_custom_battle_designer_7_locked", 1),
                        (assign, ":var_14", 0),
                        (assign, ":var_15", ":var_13"),
                    (else_try),
                        (eq, "$g_presentation_obj_custom_battle_designer_6_locked", 1),
                        (assign, ":var_14", ":var_13"),
                        (assign, ":var_15", 0),
                    (else_try),
                        (store_div, ":var_14", ":var_13", 2),
                        (store_sub, ":var_15", ":var_13", ":var_14"),
                        (try_begin),
                            (neg|eq, ":var_14", ":var_15"),
                            (store_random_in_range, ":var_16", 0, 2),
                            (eq, ":var_16", 0),
                            (val_sub, ":var_15", 1),
                            (val_add, ":var_14", 1),
                        (try_end),
                    (try_end),
                    (assign, "$g_presentation_obj_custom_battle_designer_8_last_value", ":var_1"),
                    (val_add, "$g_presentation_obj_custom_battle_designer_7_last_value", ":var_14"),
                    (val_add, "$g_presentation_obj_custom_battle_designer_6_last_value", ":var_15"),
                    (try_begin),
                        (gt, "$g_presentation_obj_custom_battle_designer_7_last_value", 100),
                        (store_sub, ":var_13", "$g_presentation_obj_custom_battle_designer_7_last_value", 100),
                        (val_add, "$g_presentation_obj_custom_battle_designer_6_last_value", ":var_13"),
                        (assign, "$g_presentation_obj_custom_battle_designer_7_last_value", 100),
                    (else_try),
                        (gt, "$g_presentation_obj_custom_battle_designer_6_last_value", 100),
                        (store_sub, ":var_13", "$g_presentation_obj_custom_battle_designer_6_last_value", 100),
                        (val_add, "$g_presentation_obj_custom_battle_designer_7_last_value", ":var_13"),
                        (assign, "$g_presentation_obj_custom_battle_designer_6_last_value", 100),
                    (try_end),
                    (overlay_set_val, "$g_presentation_obj_custom_battle_designer_7", "$g_presentation_obj_custom_battle_designer_7_last_value"),
                    (overlay_set_val, "$g_presentation_obj_custom_battle_designer_6", "$g_presentation_obj_custom_battle_designer_6_last_value"),
                (else_try),
                    (gt, ":var_1", "$g_presentation_obj_custom_battle_designer_8_last_value"),
                    (store_sub, ":var_13", ":var_1", "$g_presentation_obj_custom_battle_designer_8_last_value"),
                    (try_begin),
                        (eq, "$g_presentation_obj_custom_battle_designer_7_locked", 1),
                        (assign, ":var_14", 0),
                        (assign, ":var_15", ":var_13"),
                    (else_try),
                        (eq, "$g_presentation_obj_custom_battle_designer_6_locked", 1),
                        (assign, ":var_14", ":var_13"),
                        (assign, ":var_15", 0),
                    (else_try),
                        (store_div, ":var_14", ":var_13", 2),
                        (store_sub, ":var_15", ":var_13", ":var_14"),
                        (try_begin),
                            (neg|eq, ":var_14", ":var_15"),
                            (store_random_in_range, ":var_16", 0, 2),
                            (eq, ":var_16", 0),
                            (val_sub, ":var_15", 1),
                            (val_add, ":var_14", 1),
                        (try_end),
                    (try_end),
                    (assign, "$g_presentation_obj_custom_battle_designer_8_last_value", ":var_1"),
                    (val_sub, "$g_presentation_obj_custom_battle_designer_7_last_value", ":var_14"),
                    (val_sub, "$g_presentation_obj_custom_battle_designer_6_last_value", ":var_15"),
                    (try_begin),
                        (neg|ge, "$g_presentation_obj_custom_battle_designer_7_last_value", 0),
                        (val_add, "$g_presentation_obj_custom_battle_designer_6_last_value", "$g_presentation_obj_custom_battle_designer_7_last_value"),
                        (assign, "$g_presentation_obj_custom_battle_designer_7_last_value", 0),
                    (else_try),
                        (neg|ge, "$g_presentation_obj_custom_battle_designer_6_last_value", 0),
                        (val_add, "$g_presentation_obj_custom_battle_designer_7_last_value", "$g_presentation_obj_custom_battle_designer_6_last_value"),
                        (assign, "$g_presentation_obj_custom_battle_designer_6_last_value", 0),
                    (try_end),
                    (overlay_set_val, "$g_presentation_obj_custom_battle_designer_7", "$g_presentation_obj_custom_battle_designer_7_last_value"),
                    (overlay_set_val, "$g_presentation_obj_custom_battle_designer_6", "$g_presentation_obj_custom_battle_designer_6_last_value"),
                (try_end),
                (assign, reg0, "$g_presentation_obj_custom_battle_designer_6_last_value"),
                (overlay_set_text, "$g_presentation_obj_custom_battle_designer_12", "str_reg0_percent"),
                (assign, reg0, "$g_presentation_obj_custom_battle_designer_7_last_value"),
                (overlay_set_text, "$g_presentation_obj_custom_battle_designer_13", "str_reg0_percent"),
                (assign, reg0, "$g_presentation_obj_custom_battle_designer_8_last_value"),
                (overlay_set_text, "$g_presentation_obj_custom_battle_designer_14", "str_reg0_percent"),
            (try_end),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_custom_battle_designer_9"),
            (try_begin),
                (eq, "$g_presentation_obj_custom_battle_designer_9_locked", 1),
                (neg|eq, ":var_1", "$g_presentation_obj_custom_battle_designer_9_last_value"),
                (overlay_set_val, "$g_presentation_obj_custom_battle_designer_9", "$g_presentation_obj_custom_battle_designer_9_last_value"),
            (else_try),
                (try_begin),
                    (neg|ge, ":var_1", "$g_presentation_obj_custom_battle_designer_9_last_value"),
                    (store_sub, ":var_13", "$g_presentation_obj_custom_battle_designer_9_last_value", ":var_1"),
                    (try_begin),
                        (eq, "$g_presentation_obj_custom_battle_designer_10_locked", 1),
                        (assign, ":var_14", 0),
                        (assign, ":var_15", ":var_13"),
                    (else_try),
                        (eq, "$g_presentation_obj_custom_battle_designer_11_locked", 1),
                        (assign, ":var_14", ":var_13"),
                        (assign, ":var_15", 0),
                    (else_try),
                        (store_div, ":var_14", ":var_13", 2),
                        (store_sub, ":var_15", ":var_13", ":var_14"),
                        (try_begin),
                            (neg|eq, ":var_14", ":var_15"),
                            (store_random_in_range, ":var_16", 0, 2),
                            (eq, ":var_16", 0),
                            (val_sub, ":var_15", 1),
                            (val_add, ":var_14", 1),
                        (try_end),
                    (try_end),
                    (assign, "$g_presentation_obj_custom_battle_designer_9_last_value", ":var_1"),
                    (val_add, "$g_presentation_obj_custom_battle_designer_10_last_value", ":var_14"),
                    (val_add, "$g_presentation_obj_custom_battle_designer_11_last_value", ":var_15"),
                    (try_begin),
                        (gt, "$g_presentation_obj_custom_battle_designer_10_last_value", 100),
                        (store_sub, ":var_13", "$g_presentation_obj_custom_battle_designer_10_last_value", 100),
                        (val_add, "$g_presentation_obj_custom_battle_designer_11_last_value", ":var_13"),
                        (assign, "$g_presentation_obj_custom_battle_designer_10_last_value", 100),
                    (else_try),
                        (gt, "$g_presentation_obj_custom_battle_designer_11_last_value", 100),
                        (store_sub, ":var_13", "$g_presentation_obj_custom_battle_designer_11_last_value", 100),
                        (val_add, "$g_presentation_obj_custom_battle_designer_10_last_value", ":var_13"),
                        (assign, "$g_presentation_obj_custom_battle_designer_11_last_value", 100),
                    (try_end),
                    (overlay_set_val, "$g_presentation_obj_custom_battle_designer_10", "$g_presentation_obj_custom_battle_designer_10_last_value"),
                    (overlay_set_val, "$g_presentation_obj_custom_battle_designer_11", "$g_presentation_obj_custom_battle_designer_11_last_value"),
                (else_try),
                    (gt, ":var_1", "$g_presentation_obj_custom_battle_designer_9_last_value"),
                    (store_sub, ":var_13", ":var_1", "$g_presentation_obj_custom_battle_designer_9_last_value"),
                    (try_begin),
                        (eq, "$g_presentation_obj_custom_battle_designer_10_locked", 1),
                        (assign, ":var_14", 0),
                        (assign, ":var_15", ":var_13"),
                    (else_try),
                        (eq, "$g_presentation_obj_custom_battle_designer_11_locked", 1),
                        (assign, ":var_14", ":var_13"),
                        (assign, ":var_15", 0),
                    (else_try),
                        (store_div, ":var_14", ":var_13", 2),
                        (store_sub, ":var_15", ":var_13", ":var_14"),
                        (try_begin),
                            (neg|eq, ":var_14", ":var_15"),
                            (store_random_in_range, ":var_16", 0, 2),
                            (eq, ":var_16", 0),
                            (val_sub, ":var_15", 1),
                            (val_add, ":var_14", 1),
                        (try_end),
                    (try_end),
                    (assign, "$g_presentation_obj_custom_battle_designer_9_last_value", ":var_1"),
                    (val_sub, "$g_presentation_obj_custom_battle_designer_10_last_value", ":var_14"),
                    (val_sub, "$g_presentation_obj_custom_battle_designer_11_last_value", ":var_15"),
                    (try_begin),
                        (neg|ge, "$g_presentation_obj_custom_battle_designer_10_last_value", 0),
                        (val_add, "$g_presentation_obj_custom_battle_designer_11_last_value", "$g_presentation_obj_custom_battle_designer_10_last_value"),
                        (assign, "$g_presentation_obj_custom_battle_designer_10_last_value", 0),
                    (else_try),
                        (neg|ge, "$g_presentation_obj_custom_battle_designer_11_last_value", 0),
                        (val_add, "$g_presentation_obj_custom_battle_designer_10_last_value", "$g_presentation_obj_custom_battle_designer_11_last_value"),
                        (assign, "$g_presentation_obj_custom_battle_designer_11_last_value", 0),
                    (try_end),
                    (overlay_set_val, "$g_presentation_obj_custom_battle_designer_10", "$g_presentation_obj_custom_battle_designer_10_last_value"),
                    (overlay_set_val, "$g_presentation_obj_custom_battle_designer_11", "$g_presentation_obj_custom_battle_designer_11_last_value"),
                (try_end),
                (assign, reg0, "$g_presentation_obj_custom_battle_designer_9_last_value"),
                (overlay_set_text, "$g_presentation_obj_custom_battle_designer_15", "str_reg0_percent"),
                (assign, reg0, "$g_presentation_obj_custom_battle_designer_10_last_value"),
                (overlay_set_text, "$g_presentation_obj_custom_battle_designer_16", "str_reg0_percent"),
                (assign, reg0, "$g_presentation_obj_custom_battle_designer_11_last_value"),
                (overlay_set_text, "$g_presentation_obj_custom_battle_designer_17", "str_reg0_percent"),
            (try_end),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_custom_battle_designer_10"),
            (try_begin),
                (eq, "$g_presentation_obj_custom_battle_designer_10_locked", 1),
                (neg|eq, ":var_1", "$g_presentation_obj_custom_battle_designer_10_last_value"),
                (overlay_set_val, "$g_presentation_obj_custom_battle_designer_10", "$g_presentation_obj_custom_battle_designer_10_last_value"),
            (else_try),
                (try_begin),
                    (neg|ge, ":var_1", "$g_presentation_obj_custom_battle_designer_10_last_value"),
                    (store_sub, ":var_13", "$g_presentation_obj_custom_battle_designer_10_last_value", ":var_1"),
                    (try_begin),
                        (eq, "$g_presentation_obj_custom_battle_designer_9_locked", 1),
                        (assign, ":var_14", 0),
                        (assign, ":var_15", ":var_13"),
                    (else_try),
                        (eq, "$g_presentation_obj_custom_battle_designer_11_locked", 1),
                        (assign, ":var_14", ":var_13"),
                        (assign, ":var_15", 0),
                    (else_try),
                        (store_div, ":var_14", ":var_13", 2),
                        (store_sub, ":var_15", ":var_13", ":var_14"),
                        (try_begin),
                            (neg|eq, ":var_14", ":var_15"),
                            (store_random_in_range, ":var_16", 0, 2),
                            (eq, ":var_16", 0),
                            (val_sub, ":var_15", 1),
                            (val_add, ":var_14", 1),
                        (try_end),
                    (try_end),
                    (assign, "$g_presentation_obj_custom_battle_designer_10_last_value", ":var_1"),
                    (val_add, "$g_presentation_obj_custom_battle_designer_9_last_value", ":var_14"),
                    (val_add, "$g_presentation_obj_custom_battle_designer_11_last_value", ":var_15"),
                    (try_begin),
                        (gt, "$g_presentation_obj_custom_battle_designer_9_last_value", 100),
                        (store_sub, ":var_13", "$g_presentation_obj_custom_battle_designer_9_last_value", 100),
                        (val_add, "$g_presentation_obj_custom_battle_designer_11_last_value", ":var_13"),
                        (assign, "$g_presentation_obj_custom_battle_designer_9_last_value", 100),
                    (else_try),
                        (gt, "$g_presentation_obj_custom_battle_designer_11_last_value", 100),
                        (store_sub, ":var_13", "$g_presentation_obj_custom_battle_designer_11_last_value", 100),
                        (val_add, "$g_presentation_obj_custom_battle_designer_9_last_value", ":var_13"),
                        (assign, "$g_presentation_obj_custom_battle_designer_11_last_value", 100),
                    (try_end),
                    (overlay_set_val, "$g_presentation_obj_custom_battle_designer_9", "$g_presentation_obj_custom_battle_designer_9_last_value"),
                    (overlay_set_val, "$g_presentation_obj_custom_battle_designer_11", "$g_presentation_obj_custom_battle_designer_11_last_value"),
                (else_try),
                    (gt, ":var_1", "$g_presentation_obj_custom_battle_designer_10_last_value"),
                    (store_sub, ":var_13", ":var_1", "$g_presentation_obj_custom_battle_designer_10_last_value"),
                    (try_begin),
                        (eq, "$g_presentation_obj_custom_battle_designer_9_locked", 1),
                        (assign, ":var_14", 0),
                        (assign, ":var_15", ":var_13"),
                    (else_try),
                        (eq, "$g_presentation_obj_custom_battle_designer_11_locked", 1),
                        (assign, ":var_14", ":var_13"),
                        (assign, ":var_15", 0),
                    (else_try),
                        (store_div, ":var_14", ":var_13", 2),
                        (store_sub, ":var_15", ":var_13", ":var_14"),
                        (try_begin),
                            (neg|eq, ":var_14", ":var_15"),
                            (store_random_in_range, ":var_16", 0, 2),
                            (eq, ":var_16", 0),
                            (val_sub, ":var_15", 1),
                            (val_add, ":var_14", 1),
                        (try_end),
                    (try_end),
                    (assign, "$g_presentation_obj_custom_battle_designer_10_last_value", ":var_1"),
                    (val_sub, "$g_presentation_obj_custom_battle_designer_9_last_value", ":var_14"),
                    (val_sub, "$g_presentation_obj_custom_battle_designer_11_last_value", ":var_15"),
                    (try_begin),
                        (neg|ge, "$g_presentation_obj_custom_battle_designer_9_last_value", 0),
                        (val_add, "$g_presentation_obj_custom_battle_designer_11_last_value", "$g_presentation_obj_custom_battle_designer_9_last_value"),
                        (assign, "$g_presentation_obj_custom_battle_designer_9_last_value", 0),
                    (else_try),
                        (neg|ge, "$g_presentation_obj_custom_battle_designer_11_last_value", 0),
                        (val_add, "$g_presentation_obj_custom_battle_designer_9_last_value", "$g_presentation_obj_custom_battle_designer_11_last_value"),
                        (assign, "$g_presentation_obj_custom_battle_designer_11_last_value", 0),
                    (try_end),
                    (overlay_set_val, "$g_presentation_obj_custom_battle_designer_9", "$g_presentation_obj_custom_battle_designer_9_last_value"),
                    (overlay_set_val, "$g_presentation_obj_custom_battle_designer_11", "$g_presentation_obj_custom_battle_designer_11_last_value"),
                (try_end),
                (assign, reg0, "$g_presentation_obj_custom_battle_designer_9_last_value"),
                (overlay_set_text, "$g_presentation_obj_custom_battle_designer_15", "str_reg0_percent"),
                (assign, reg0, "$g_presentation_obj_custom_battle_designer_10_last_value"),
                (overlay_set_text, "$g_presentation_obj_custom_battle_designer_16", "str_reg0_percent"),
                (assign, reg0, "$g_presentation_obj_custom_battle_designer_11_last_value"),
                (overlay_set_text, "$g_presentation_obj_custom_battle_designer_17", "str_reg0_percent"),
            (try_end),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_custom_battle_designer_11"),
            (try_begin),
                (eq, "$g_presentation_obj_custom_battle_designer_11_locked", 1),
                (neg|eq, ":var_1", "$g_presentation_obj_custom_battle_designer_11_last_value"),
                (overlay_set_val, "$g_presentation_obj_custom_battle_designer_11", "$g_presentation_obj_custom_battle_designer_11_last_value"),
            (else_try),
                (try_begin),
                    (neg|ge, ":var_1", "$g_presentation_obj_custom_battle_designer_11_last_value"),
                    (store_sub, ":var_13", "$g_presentation_obj_custom_battle_designer_11_last_value", ":var_1"),
                    (try_begin),
                        (eq, "$g_presentation_obj_custom_battle_designer_10_locked", 1),
                        (assign, ":var_14", 0),
                        (assign, ":var_15", ":var_13"),
                    (else_try),
                        (eq, "$g_presentation_obj_custom_battle_designer_9_locked", 1),
                        (assign, ":var_14", ":var_13"),
                        (assign, ":var_15", 0),
                    (else_try),
                        (store_div, ":var_14", ":var_13", 2),
                        (store_sub, ":var_15", ":var_13", ":var_14"),
                        (try_begin),
                            (neg|eq, ":var_14", ":var_15"),
                            (store_random_in_range, ":var_16", 0, 2),
                            (eq, ":var_16", 0),
                            (val_sub, ":var_15", 1),
                            (val_add, ":var_14", 1),
                        (try_end),
                    (try_end),
                    (assign, "$g_presentation_obj_custom_battle_designer_11_last_value", ":var_1"),
                    (val_add, "$g_presentation_obj_custom_battle_designer_10_last_value", ":var_14"),
                    (val_add, "$g_presentation_obj_custom_battle_designer_9_last_value", ":var_15"),
                    (try_begin),
                        (gt, "$g_presentation_obj_custom_battle_designer_10_last_value", 100),
                        (store_sub, ":var_13", "$g_presentation_obj_custom_battle_designer_10_last_value", 100),
                        (val_add, "$g_presentation_obj_custom_battle_designer_9_last_value", ":var_13"),
                        (assign, "$g_presentation_obj_custom_battle_designer_10_last_value", 100),
                    (else_try),
                        (gt, "$g_presentation_obj_custom_battle_designer_9_last_value", 100),
                        (store_sub, ":var_13", "$g_presentation_obj_custom_battle_designer_9_last_value", 100),
                        (val_add, "$g_presentation_obj_custom_battle_designer_10_last_value", ":var_13"),
                        (assign, "$g_presentation_obj_custom_battle_designer_9_last_value", 100),
                    (try_end),
                    (overlay_set_val, "$g_presentation_obj_custom_battle_designer_10", "$g_presentation_obj_custom_battle_designer_10_last_value"),
                    (overlay_set_val, "$g_presentation_obj_custom_battle_designer_9", "$g_presentation_obj_custom_battle_designer_9_last_value"),
                (else_try),
                    (gt, ":var_1", "$g_presentation_obj_custom_battle_designer_11_last_value"),
                    (store_sub, ":var_13", ":var_1", "$g_presentation_obj_custom_battle_designer_11_last_value"),
                    (try_begin),
                        (eq, "$g_presentation_obj_custom_battle_designer_10_locked", 1),
                        (assign, ":var_14", 0),
                        (assign, ":var_15", ":var_13"),
                    (else_try),
                        (eq, "$g_presentation_obj_custom_battle_designer_9_locked", 1),
                        (assign, ":var_14", ":var_13"),
                        (assign, ":var_15", 0),
                    (else_try),
                        (store_div, ":var_14", ":var_13", 2),
                        (store_sub, ":var_15", ":var_13", ":var_14"),
                        (try_begin),
                            (neg|eq, ":var_14", ":var_15"),
                            (store_random_in_range, ":var_16", 0, 2),
                            (eq, ":var_16", 0),
                            (val_sub, ":var_15", 1),
                            (val_add, ":var_14", 1),
                        (try_end),
                    (try_end),
                    (assign, "$g_presentation_obj_custom_battle_designer_11_last_value", ":var_1"),
                    (val_sub, "$g_presentation_obj_custom_battle_designer_10_last_value", ":var_14"),
                    (val_sub, "$g_presentation_obj_custom_battle_designer_9_last_value", ":var_15"),
                    (try_begin),
                        (neg|ge, "$g_presentation_obj_custom_battle_designer_10_last_value", 0),
                        (val_add, "$g_presentation_obj_custom_battle_designer_9_last_value", "$g_presentation_obj_custom_battle_designer_10_last_value"),
                        (assign, "$g_presentation_obj_custom_battle_designer_10_last_value", 0),
                    (else_try),
                        (neg|ge, "$g_presentation_obj_custom_battle_designer_9_last_value", 0),
                        (val_add, "$g_presentation_obj_custom_battle_designer_10_last_value", "$g_presentation_obj_custom_battle_designer_9_last_value"),
                        (assign, "$g_presentation_obj_custom_battle_designer_9_last_value", 0),
                    (try_end),
                    (overlay_set_val, "$g_presentation_obj_custom_battle_designer_10", "$g_presentation_obj_custom_battle_designer_10_last_value"),
                    (overlay_set_val, "$g_presentation_obj_custom_battle_designer_9", "$g_presentation_obj_custom_battle_designer_9_last_value"),
                (try_end),
                (assign, reg0, "$g_presentation_obj_custom_battle_designer_9_last_value"),
                (overlay_set_text, "$g_presentation_obj_custom_battle_designer_15", "str_reg0_percent"),
                (assign, reg0, "$g_presentation_obj_custom_battle_designer_10_last_value"),
                (overlay_set_text, "$g_presentation_obj_custom_battle_designer_16", "str_reg0_percent"),
                (assign, reg0, "$g_presentation_obj_custom_battle_designer_11_last_value"),
                (overlay_set_text, "$g_presentation_obj_custom_battle_designer_17", "str_reg0_percent"),
            (try_end),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_custom_battle_designer_19"),
            (assign, "$g_is_quick_battle", 1),
            (assign, ":var_17", "$g_quick_battle_map"),
            (try_begin),
                (eq, "$g_quick_battle_game_type", 0),
                (assign, ":var_18", "mt_quick_battle_battle"),
                (modify_visitors_at_site, ":var_17"),
                (call_script, "script_spawn_quick_battle_army", 0, "$g_quick_battle_team_1_faction", "$g_presentation_obj_custom_battle_designer_6_last_value", "$g_presentation_obj_custom_battle_designer_7_last_value", "$g_presentation_obj_custom_battle_designer_8_last_value", 0, 1),
                (call_script, "script_spawn_quick_battle_army", 16, "$g_quick_battle_team_2_faction", "$g_presentation_obj_custom_battle_designer_9_last_value", "$g_presentation_obj_custom_battle_designer_10_last_value", "$g_presentation_obj_custom_battle_designer_11_last_value", 0, 0),
            (else_try),
                (eq, "$g_quick_battle_game_type", 1),
                (assign, ":var_18", "mt_quick_battle_siege"),
                (modify_visitors_at_site, ":var_17"),
                (call_script, "script_spawn_quick_battle_army", 16, "$g_quick_battle_team_1_faction", "$g_presentation_obj_custom_battle_designer_6_last_value", "$g_presentation_obj_custom_battle_designer_7_last_value", "$g_presentation_obj_custom_battle_designer_8_last_value", 0, 1),
                (call_script, "script_spawn_quick_battle_army", 0, "$g_quick_battle_team_2_faction", "$g_presentation_obj_custom_battle_designer_9_last_value", "$g_presentation_obj_custom_battle_designer_10_last_value", "$g_presentation_obj_custom_battle_designer_11_last_value", 1, 0),
            (else_try),
                (assign, ":var_18", "mt_quick_battle_siege"),
                (modify_visitors_at_site, ":var_17"),
                (call_script, "script_spawn_quick_battle_army", 0, "$g_quick_battle_team_1_faction", "$g_presentation_obj_custom_battle_designer_6_last_value", "$g_presentation_obj_custom_battle_designer_7_last_value", "$g_presentation_obj_custom_battle_designer_8_last_value", 1, 1),
                (call_script, "script_spawn_quick_battle_army", 16, "$g_quick_battle_team_2_faction", "$g_presentation_obj_custom_battle_designer_9_last_value", "$g_presentation_obj_custom_battle_designer_10_last_value", "$g_presentation_obj_custom_battle_designer_11_last_value", 0, 0),
            (try_end),
            (set_jump_mission, ":var_18"),
            (jump_to_menu, "mnu_custom_battle_end"),
            (jump_to_scene, ":var_17"),
            (change_screen_mission),
            (presentation_set_duration, 0),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_custom_battle_designer_20"),
            (presentation_set_duration, 0),
        (try_end),
    ]),
    (ti_on_presentation_mouse_enter_leave, [
        (store_trigger_param_1, ":var_0"),
        (store_trigger_param_2, ":var_1"),
        (this_or_next|eq, ":var_0", "$g_presentation_obj_custom_battle_designer_6"),
        (this_or_next|eq, ":var_0", "$g_presentation_obj_custom_battle_designer_7"),
        (this_or_next|eq, ":var_0", "$g_presentation_obj_custom_battle_designer_8"),
        (this_or_next|eq, ":var_0", "$g_presentation_obj_custom_battle_designer_9"),
        (this_or_next|eq, ":var_0", "$g_presentation_obj_custom_battle_designer_10"),
        (eq, ":var_0", "$g_presentation_obj_custom_battle_designer_11"),
        (try_begin),
            (eq, ":var_1", 1),
            (try_begin),
                (eq, ":var_0", "$g_presentation_obj_custom_battle_last_mouse_over_object"),
                (assign, "$g_presentation_obj_custom_battle_last_mouse_over_object", -1),
            (try_end),
        (else_try),
            (assign, "$g_presentation_obj_custom_battle_last_mouse_over_object", ":var_0"),
        (try_end),
    ]),
    (ti_on_presentation_run, [
        (try_begin),
            (key_clicked, key_escape),
            (presentation_set_duration, 0),
        (else_try),
            (key_clicked, key_right_mouse_button),
            (neg|eq, "$g_presentation_obj_custom_battle_last_mouse_over_object", -1),
            (try_begin),
                (eq, "$g_presentation_obj_custom_battle_last_mouse_over_object", "$g_presentation_obj_custom_battle_designer_6"),
                (try_begin),
                    (eq, "$g_presentation_obj_custom_battle_designer_6_locked", 0),
                    (assign, "$g_presentation_obj_custom_battle_designer_6_locked", 1),
                    (assign, "$g_presentation_obj_custom_battle_designer_7_locked", 0),
                    (assign, "$g_presentation_obj_custom_battle_designer_8_locked", 0),
                (else_try),
                    (assign, "$g_presentation_obj_custom_battle_designer_6_locked", 0),
                (try_end),
            (else_try),
                (eq, "$g_presentation_obj_custom_battle_last_mouse_over_object", "$g_presentation_obj_custom_battle_designer_7"),
                (try_begin),
                    (eq, "$g_presentation_obj_custom_battle_designer_7_locked", 0),
                    (assign, "$g_presentation_obj_custom_battle_designer_6_locked", 0),
                    (assign, "$g_presentation_obj_custom_battle_designer_7_locked", 1),
                    (assign, "$g_presentation_obj_custom_battle_designer_8_locked", 0),
                (else_try),
                    (assign, "$g_presentation_obj_custom_battle_designer_7_locked", 0),
                (try_end),
            (else_try),
                (eq, "$g_presentation_obj_custom_battle_last_mouse_over_object", "$g_presentation_obj_custom_battle_designer_8"),
                (try_begin),
                    (eq, "$g_presentation_obj_custom_battle_designer_8_locked", 0),
                    (assign, "$g_presentation_obj_custom_battle_designer_6_locked", 0),
                    (assign, "$g_presentation_obj_custom_battle_designer_7_locked", 0),
                    (assign, "$g_presentation_obj_custom_battle_designer_8_locked", 1),
                (else_try),
                    (assign, "$g_presentation_obj_custom_battle_designer_8_locked", 0),
                (try_end),
            (else_try),
                (eq, "$g_presentation_obj_custom_battle_last_mouse_over_object", "$g_presentation_obj_custom_battle_designer_9"),
                (try_begin),
                    (eq, "$g_presentation_obj_custom_battle_designer_9_locked", 0),
                    (assign, "$g_presentation_obj_custom_battle_designer_9_locked", 1),
                    (assign, "$g_presentation_obj_custom_battle_designer_10_locked", 0),
                    (assign, "$g_presentation_obj_custom_battle_designer_11_locked", 0),
                (else_try),
                    (assign, "$g_presentation_obj_custom_battle_designer_9_locked", 0),
                (try_end),
            (else_try),
                (eq, "$g_presentation_obj_custom_battle_last_mouse_over_object", "$g_presentation_obj_custom_battle_designer_10"),
                (try_begin),
                    (eq, "$g_presentation_obj_custom_battle_designer_10_locked", 0),
                    (assign, "$g_presentation_obj_custom_battle_designer_9_locked", 0),
                    (assign, "$g_presentation_obj_custom_battle_designer_10_locked", 1),
                    (assign, "$g_presentation_obj_custom_battle_designer_11_locked", 0),
                (else_try),
                    (assign, "$g_presentation_obj_custom_battle_designer_10_locked", 0),
                (try_end),
            (else_try),
                (eq, "$g_presentation_obj_custom_battle_last_mouse_over_object", "$g_presentation_obj_custom_battle_designer_11"),
                (try_begin),
                    (eq, "$g_presentation_obj_custom_battle_designer_11_locked", 0),
                    (assign, "$g_presentation_obj_custom_battle_designer_9_locked", 0),
                    (assign, "$g_presentation_obj_custom_battle_designer_10_locked", 0),
                    (assign, "$g_presentation_obj_custom_battle_designer_11_locked", 1),
                (else_try),
                    (assign, "$g_presentation_obj_custom_battle_designer_11_locked", 0),
                (try_end),
            (try_end),
        (try_end),
    ]),
]),

("game_multiplayer_admin_panel", prsntf_manual_end_only, 0, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (try_begin),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_1"),
            (assign, ":var_0", "mesh_mp_ui_host_maps_1"),
        (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_2"),
            (assign, ":var_0", "mesh_mp_ui_host_maps_2"),
        (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_3"),
            (assign, ":var_0", "mesh_mp_ui_host_maps_3"),
        (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_4"),
            (assign, ":var_0", "mesh_mp_ui_host_maps_4"),
        (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_5"),
            (assign, ":var_0", "mesh_mp_ui_host_maps_5"),
        (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_6"),
            (assign, ":var_0", "mesh_mp_ui_host_maps_6"),
        (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_7"),
            (assign, ":var_0", "mesh_mp_ui_host_maps_7"),
        (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_8"),
            (assign, ":var_0", "mesh_mp_ui_host_maps_8"),
        (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_9"),
            (assign, ":var_0", "mesh_mp_ui_host_maps_9"),
        (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_10"),
            (assign, ":var_0", "mesh_mp_ui_host_maps_10"),
        (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_11"),
            (assign, ":var_0", "mesh_mp_ui_host_maps_11"),
        (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_12"),
            (assign, ":var_0", "mesh_mp_ui_host_maps_12"),
        (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_13"),
            (assign, ":var_0", "mesh_mp_ui_host_maps_13"),
        (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_14"),
            (assign, ":var_0", "mesh_mp_ui_host_maps_14"),
        (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_15"),
            (assign, ":var_0", "mesh_mp_ui_host_maps_15"),
        (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_16"),
            (assign, ":var_0", "mesh_mp_ui_host_maps_16"),
        (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_17"),
            (assign, ":var_0", "mesh_mp_ui_host_maps_17"),
        (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_18"),
            (assign, ":var_0", "mesh_mp_ui_host_maps_18"),
        (else_try),
            (this_or_next|eq, "$g_multiplayer_selected_map", "scn_random_multi_plain_medium"),
            (eq, "$g_multiplayer_selected_map", "scn_random_multi_plain_large"),
            (assign, ":var_0", "mesh_mp_ui_host_maps_randomp"),
        (else_try),
            (this_or_next|eq, "$g_multiplayer_selected_map", "scn_random_multi_steppe_medium"),
            (eq, "$g_multiplayer_selected_map", "scn_random_multi_steppe_large"),
            (assign, ":var_0", "mesh_mp_ui_host_maps_randoms"),
        (else_try),
            (assign, ":var_0", "mesh_mp_ui_host_maps_randomp"),
        (try_end),
        (create_mesh_overlay, reg0, ":var_0"),
        (position_set_x, pos1, -1),
        (position_set_y, pos1, 550),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1002),
        (position_set_y, pos1, 1002),
        (overlay_set_size, reg0, pos1),
        (create_mesh_overlay, reg0, "mesh_mp_ui_host_main"),
        (position_set_x, pos1, -1),
        (position_set_y, pos1, -1),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1002),
        (position_set_y, pos1, 1002),
        (overlay_set_size, reg0, pos1),
        (assign, ":var_1", 1240),
        (assign, ":var_2", 40),
        (try_begin),
            (this_or_next|eq, "$g_multiplayer_game_type", 1),
            (this_or_next|eq, "$g_multiplayer_game_type", 2),
            (this_or_next|eq, "$g_multiplayer_game_type", 3),
            (this_or_next|eq, "$g_multiplayer_game_type", 4),
            (this_or_next|eq, "$g_multiplayer_game_type", 5),
            (eq, "$g_multiplayer_game_type", 6),
            (val_add, ":var_1", ":var_2"),
            (val_add, ":var_1", ":var_2"),
            (this_or_next|eq, "$g_multiplayer_game_type", 4),
            (this_or_next|eq, "$g_multiplayer_game_type", 2),
            (this_or_next|eq, "$g_multiplayer_game_type", 3),
            (eq, "$g_multiplayer_game_type", 6),
            (val_add, ":var_1", ":var_2"),
            (this_or_next|eq, "$g_multiplayer_game_type", 2),
            (this_or_next|eq, "$g_multiplayer_game_type", 3),
            (eq, "$g_multiplayer_game_type", 6),
            (val_add, ":var_1", ":var_2"),
            (this_or_next|eq, "$g_multiplayer_game_type", 2),
            (this_or_next|eq, "$g_multiplayer_game_type", 3),
            (eq, "$g_multiplayer_game_type", 6),
            (val_add, ":var_1", ":var_2"),
        (try_end),
        (str_clear, s0),
        (create_text_overlay, "$g_presentation_obj_admin_panel_container", 0, 8192),
        (position_set_x, pos1, 59),
        (position_set_y, pos1, 50),
        (overlay_set_position, "$g_presentation_obj_admin_panel_container", pos1),
        (position_set_x, pos1, 640),
        (position_set_y, pos1, 520),
        (overlay_set_area_size, "$g_presentation_obj_admin_panel_container", pos1),
        (set_container_overlay, "$g_presentation_obj_admin_panel_container"),
        (create_text_overlay, reg0, "str_add_to_official_game_servers_list", 0),
        (position_set_x, pos1, 30),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg0, pos1),
        (create_check_box_overlay, "$g_presentation_obj_admin_panel_14", "mesh_checkbox_off", "mesh_checkbox_on"),
        (position_set_x, pos1, 7),
        (store_add, ":var_3", ":var_1", 7),
        (position_set_y, pos1, ":var_3"),
        (overlay_set_position, "$g_presentation_obj_admin_panel_14", pos1),
        (server_get_add_to_game_servers_list, ":var_4"),
        (overlay_set_val, "$g_presentation_obj_admin_panel_14", ":var_4"),
        (val_sub, ":var_1", ":var_2"),
        (create_text_overlay, reg0, "str_enable_valve_anti_cheat", 0),
        (position_set_x, pos1, 30),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg0, pos1),
        (create_check_box_overlay, "$g_presentation_obj_admin_panel_41", "mesh_checkbox_off", "mesh_checkbox_on"),
        (position_set_x, pos1, 7),
        (store_add, ":var_3", ":var_1", 7),
        (position_set_y, pos1, ":var_3"),
        (overlay_set_position, "$g_presentation_obj_admin_panel_41", pos1),
        (server_get_anti_cheat, ":var_5"),
        (overlay_set_val, "$g_presentation_obj_admin_panel_41", ":var_5"),
        (val_sub, ":var_1", ":var_2"),
        (create_text_overlay, reg0, "str_server_name", 0),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg0, pos1),
        (str_store_server_name, s0),
        (try_begin),
            (eq, "$g_multiplayer_renaming_server_allowed", 1),
            (create_simple_text_box_overlay, "$g_presentation_obj_admin_panel_20"),
            (position_set_x, pos1, 390),
            (position_set_y, pos1, ":var_1"),
            (overlay_set_position, "$g_presentation_obj_admin_panel_20", pos1),
            (overlay_set_text, "$g_presentation_obj_admin_panel_20", 0),
        (else_try),
            (assign, "$g_presentation_obj_admin_panel_20", -1),
            (create_text_overlay, reg0, 0, 0),
            (position_set_x, pos1, 385),
            (position_set_y, pos1, ":var_1"),
            (overlay_set_position, reg0, pos1),
        (try_end),
        (val_sub, ":var_1", ":var_2"),
        (create_text_overlay, reg0, "str_game_password", 0),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg0, pos1),
        (create_simple_text_box_overlay, "$g_presentation_obj_admin_panel_9"),
        (position_set_x, pos1, 390),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, "$g_presentation_obj_admin_panel_9", pos1),
        (str_store_server_password, s0),
        (overlay_set_text, "$g_presentation_obj_admin_panel_9", 0),
        (val_sub, ":var_1", ":var_2"),
        (create_text_overlay, reg0, "str_welcome_message", 0),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg0, pos1),
        (create_simple_text_box_overlay, "$g_presentation_obj_admin_panel_32"),
        (position_set_x, pos1, 390),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, "$g_presentation_obj_admin_panel_32", pos1),
        (str_store_welcome_message, s0),
        (overlay_set_text, "$g_presentation_obj_admin_panel_32", 0),
        (val_sub, ":var_1", ":var_2"),
        (create_text_overlay, reg0, "str_map", 0),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg0, pos1),
        (call_script, "script_multiplayer_fill_map_game_types", "$g_multiplayer_game_type"),
        (assign, ":var_6", reg0),
        (assign, ":var_7", 0),
        (try_begin),
            (gt, ":var_6", 12),
            (create_combo_label_overlay, "$g_presentation_obj_admin_panel_1"),
        (else_try),
            (create_combo_button_overlay, "$g_presentation_obj_admin_panel_1"),
        (try_end),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, "$g_presentation_obj_admin_panel_1", pos1),
        (try_begin),
            (gt, ":var_6", 14),
            (position_set_x, pos1, 465),
        (else_try),
            (position_set_x, pos1, 490),
        (try_end),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, "$g_presentation_obj_admin_panel_1", pos1),
        (troop_get_slot, ":var_8", "trp_multiplayer_data", slot_troop_relations_begin),
        (assign, ":var_9", 0),
        (try_for_range, ":var_10", 0, ":var_6"),
            (store_add, ":var_11", ":var_10", 0),
            (troop_get_slot, ":var_12", "trp_multiplayer_data", ":var_11"),
            (store_sub, ":var_13", ":var_12", "scn_multi_scene_1"),
            (val_add, ":var_13", "str_multi_scene_1"),
            (str_store_string, s0, ":var_13"),
            (overlay_add_item, "$g_presentation_obj_admin_panel_1", 0),
            (try_begin),
                (eq, ":var_12", "$g_multiplayer_selected_map"),
                (assign, ":var_7", ":var_10"),
                (assign, ":var_9", 1),
            (try_end),
        (try_end),
        (overlay_set_val, "$g_presentation_obj_admin_panel_1", ":var_7"),
        (val_sub, ":var_1", ":var_2"),
        (create_text_overlay, reg0, "str_game_type", 0),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg0, pos1),
        (try_begin),
            (eq, "$g_multiplayer_changing_game_type_allowed", 1),
            (create_combo_button_overlay, "$g_presentation_obj_admin_panel_10"),
            (position_set_x, pos1, 800),
            (position_set_y, pos1, 800),
            (overlay_set_size, "$g_presentation_obj_admin_panel_10", pos1),
            (position_set_x, pos1, 490),
            (position_set_y, pos1, ":var_1"),
            (overlay_set_position, "$g_presentation_obj_admin_panel_10", pos1),
            (try_for_range, ":var_14", 0, 8),
                (store_add, ":var_13", ":var_14", "str_multi_game_type_1"),
                (str_store_string, s0, ":var_13"),
                (overlay_add_item, "$g_presentation_obj_admin_panel_10", 0),
            (try_end),
            (overlay_set_val, "$g_presentation_obj_admin_panel_10", "$g_multiplayer_game_type"),
        (else_try),
            (assign, "$g_presentation_obj_admin_panel_10", -1),
            (store_add, ":var_13", "$g_multiplayer_game_type", "str_multi_game_type_1"),
            (str_store_string, s0, ":var_13"),
            (create_text_overlay, reg0, 0, 0),
            (position_set_x, pos1, 385),
            (position_set_y, pos1, ":var_1"),
            (overlay_set_position, reg0, pos1),
        (try_end),
        (val_sub, ":var_1", ":var_2"),
        (assign, reg1, 1),
        (create_text_overlay, reg0, "str_team_reg1_faction", 0),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg0, pos1),
        (create_combo_button_overlay, "$g_presentation_obj_admin_panel_11"),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, "$g_presentation_obj_admin_panel_11", pos1),
        (position_set_x, pos1, 490),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, "$g_presentation_obj_admin_panel_11", pos1),
        (call_script, "script_multiplayer_fill_available_factions_combo_button", "$g_presentation_obj_admin_panel_11", "$g_multiplayer_next_team_1_faction", "$g_multiplayer_next_team_2_faction"),
        (val_sub, ":var_1", ":var_2"),
        (assign, reg1, 2),
        (create_text_overlay, reg0, "str_team_reg1_faction", 0),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg0, pos1),
        (create_combo_button_overlay, "$g_presentation_obj_admin_panel_12"),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, "$g_presentation_obj_admin_panel_12", pos1),
        (position_set_x, pos1, 490),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, "$g_presentation_obj_admin_panel_12", pos1),
        (call_script, "script_multiplayer_fill_available_factions_combo_button", "$g_presentation_obj_admin_panel_12", "$g_multiplayer_next_team_2_faction", "$g_multiplayer_next_team_1_faction"),
        (val_sub, ":var_1", ":var_2"),
        (assign, reg1, 1),
        (create_text_overlay, reg0, "str_max_number_of_players", 0),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg0, pos1),
        (create_number_box_overlay, "$g_presentation_obj_admin_panel_21", 2, 65),
        (position_set_x, pos1, 390),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, "$g_presentation_obj_admin_panel_21", pos1),
        (server_get_max_num_players, ":var_15"),
        (overlay_set_val, "$g_presentation_obj_admin_panel_21", ":var_15"),
        (val_sub, ":var_1", ":var_2"),
        (assign, reg1, 1),
        (create_text_overlay, reg0, "str_number_of_bots_in_team_reg1", 0),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg0, pos1),
        (create_number_box_overlay, "$g_presentation_obj_admin_panel_3", 0, "$g_multiplayer_max_num_bots"),
        (position_set_x, pos1, 390),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, "$g_presentation_obj_admin_panel_3", pos1),
        (overlay_set_val, "$g_presentation_obj_admin_panel_3", "$g_multiplayer_num_bots_team_1"),
        (val_sub, ":var_1", ":var_2"),
        (assign, reg1, 2),
        (create_text_overlay, reg0, "str_number_of_bots_in_team_reg1", 0),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg0, pos1),
        (create_number_box_overlay, "$g_presentation_obj_admin_panel_4", 0, "$g_multiplayer_max_num_bots"),
        (position_set_x, pos1, 390),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, "$g_presentation_obj_admin_panel_4", pos1),
        (overlay_set_val, "$g_presentation_obj_admin_panel_4", "$g_multiplayer_num_bots_team_2"),
        (try_begin),
            (neg|eq, "$g_multiplayer_game_type", 0),
            (neg|eq, "$g_multiplayer_game_type", 7),
            (val_sub, ":var_1", ":var_2"),
            (create_text_overlay, reg0, "str_allow_friendly_fire", 0),
            (position_set_x, pos1, 30),
            (position_set_y, pos1, ":var_1"),
            (overlay_set_position, reg0, pos1),
            (create_check_box_overlay, "$g_presentation_obj_admin_panel_5", "mesh_checkbox_off", "mesh_checkbox_on"),
            (position_set_x, pos1, 7),
            (store_add, ":var_3", ":var_1", 7),
            (position_set_y, pos1, ":var_3"),
            (overlay_set_position, "$g_presentation_obj_admin_panel_5", pos1),
            (server_get_friendly_fire, ":var_16"),
            (overlay_set_val, "$g_presentation_obj_admin_panel_5", ":var_16"),
            (val_sub, ":var_1", ":var_2"),
            (create_text_overlay, reg0, "str_allow_melee_friendly_fire", 0),
            (position_set_x, pos1, 30),
            (position_set_y, pos1, ":var_1"),
            (overlay_set_position, reg0, pos1),
            (create_check_box_overlay, "$g_presentation_obj_admin_panel_36", "mesh_checkbox_off", "mesh_checkbox_on"),
            (position_set_x, pos1, 7),
            (store_add, ":var_3", ":var_1", 7),
            (position_set_y, pos1, ":var_3"),
            (overlay_set_position, "$g_presentation_obj_admin_panel_36", pos1),
            (server_get_melee_friendly_fire, ":var_17"),
            (overlay_set_val, "$g_presentation_obj_admin_panel_36", ":var_17"),
        (try_end),
        (val_sub, ":var_1", ":var_2"),
        (create_text_overlay, reg0, "str_friendly_fire_damage_self_ratio", 0),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg0, pos1),
        (create_number_box_overlay, "$g_presentation_obj_admin_panel_37", 0, 101),
        (position_set_x, pos1, 390),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, "$g_presentation_obj_admin_panel_37", pos1),
        (server_get_friendly_fire_damage_self_ratio, ":var_18"),
        (overlay_set_val, "$g_presentation_obj_admin_panel_37", ":var_18"),
        (val_sub, ":var_1", ":var_2"),
        (create_text_overlay, reg0, "str_friendly_fire_damage_friend_ratio", 0),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg0, pos1),
        (create_number_box_overlay, "$g_presentation_obj_admin_panel_38", 0, 101),
        (position_set_x, pos1, 390),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, "$g_presentation_obj_admin_panel_38", pos1),
        (server_get_friendly_fire_damage_friend_ratio, ":var_19"),
        (overlay_set_val, "$g_presentation_obj_admin_panel_38", ":var_19"),
        (val_sub, ":var_1", ":var_2"),
        (create_text_overlay, reg0, "str_spectator_camera", 0),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg0, pos1),
        (create_combo_button_overlay, "$g_presentation_obj_admin_panel_19"),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, "$g_presentation_obj_admin_panel_19", pos1),
        (position_set_x, pos1, 490),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, "$g_presentation_obj_admin_panel_19", pos1),
        (overlay_add_item, "$g_presentation_obj_admin_panel_19", "str_free"),
        (overlay_add_item, "$g_presentation_obj_admin_panel_19", "str_stick_to_any_player"),
        (overlay_add_item, "$g_presentation_obj_admin_panel_19", "str_stick_to_team_members"),
        (overlay_add_item, "$g_presentation_obj_admin_panel_19", "str_stick_to_team_members_view"),
        (server_get_ghost_mode, ":var_20"),
        (overlay_set_val, "$g_presentation_obj_admin_panel_19", ":var_20"),
        (val_sub, ":var_1", ":var_2"),
        (create_text_overlay, reg0, "str_control_block_direction", 0),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg0, pos1),
        (create_combo_button_overlay, "$g_presentation_obj_admin_panel_15"),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, "$g_presentation_obj_admin_panel_15", pos1),
        (position_set_x, pos1, 490),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, "$g_presentation_obj_admin_panel_15", pos1),
        (overlay_add_item, "$g_presentation_obj_admin_panel_15", "str_automatic"),
        (overlay_add_item, "$g_presentation_obj_admin_panel_15", "str_by_mouse_movement"),
        (server_get_control_block_dir, ":var_21"),
        (overlay_set_val, "$g_presentation_obj_admin_panel_15", ":var_21"),
        (val_sub, ":var_1", ":var_2"),
        (create_text_overlay, reg0, "str_combat_speed", 0),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg0, pos1),
        (create_combo_button_overlay, "$g_presentation_obj_admin_panel_26"),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, "$g_presentation_obj_admin_panel_26", pos1),
        (position_set_x, pos1, 490),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, "$g_presentation_obj_admin_panel_26", pos1),
        (overlay_add_item, "$g_presentation_obj_admin_panel_26", "str_combat_speed_0"),
        (overlay_add_item, "$g_presentation_obj_admin_panel_26", "str_combat_speed_1"),
        (overlay_add_item, "$g_presentation_obj_admin_panel_26", "str_combat_speed_2"),
        (overlay_add_item, "$g_presentation_obj_admin_panel_26", "str_combat_speed_3"),
        (overlay_add_item, "$g_presentation_obj_admin_panel_26", "str_combat_speed_4"),
        (server_get_combat_speed, ":var_22"),
        (overlay_set_val, "$g_presentation_obj_admin_panel_26", ":var_22"),
        (try_begin),
            (neg|eq, "$g_multiplayer_game_type", 5),
            (val_sub, ":var_1", ":var_2"),
            (create_text_overlay, reg0, "str_map_time_limit", 0),
            (position_set_x, pos1, 0),
            (position_set_y, pos1, ":var_1"),
            (overlay_set_position, reg0, pos1),
            (create_number_box_overlay, "$g_presentation_obj_admin_panel_7", 5, 121),
            (position_set_x, pos1, 390),
            (position_set_y, pos1, ":var_1"),
            (overlay_set_position, "$g_presentation_obj_admin_panel_7", pos1),
            (overlay_set_val, "$g_presentation_obj_admin_panel_7", "$g_multiplayer_game_max_minutes"),
        (else_try),
            (assign, "$g_presentation_obj_admin_panel_7", -1),
        (try_end),
        (try_begin),
            (this_or_next|eq, "$g_multiplayer_game_type", 2),
            (this_or_next|eq, "$g_multiplayer_game_type", 3),
            (eq, "$g_multiplayer_game_type", 6),
            (val_sub, ":var_1", ":var_2"),
            (create_text_overlay, reg0, "str_round_time_limit", 0),
            (position_set_x, pos1, 0),
            (position_set_y, pos1, ":var_1"),
            (overlay_set_position, reg0, pos1),
            (create_number_box_overlay, "$g_presentation_obj_admin_panel_16", 60, 901),
            (position_set_x, pos1, 390),
            (position_set_y, pos1, ":var_1"),
            (overlay_set_position, "$g_presentation_obj_admin_panel_16", pos1),
            (overlay_set_val, "$g_presentation_obj_admin_panel_16", "$g_multiplayer_round_max_seconds"),
        (else_try),
            (assign, "$g_presentation_obj_admin_panel_16", -1),
        (try_end),
        (try_begin),
            (this_or_next|eq, "$g_multiplayer_game_type", 2),
            (eq, "$g_multiplayer_game_type", 3),
            (val_sub, ":var_1", ":var_2"),
            (create_text_overlay, reg0, "str_players_take_control_of_a_bot_after_death", 0),
            (position_set_x, pos1, 30),
            (position_set_y, pos1, ":var_1"),
            (overlay_set_position, reg0, pos1),
            (create_check_box_overlay, "$g_presentation_obj_admin_panel_25", "mesh_checkbox_off", "mesh_checkbox_on"),
            (position_set_x, pos1, 7),
            (store_add, ":var_3", ":var_1", 7),
            (position_set_y, pos1, ":var_3"),
            (overlay_set_position, "$g_presentation_obj_admin_panel_25", pos1),
            (overlay_set_val, "$g_presentation_obj_admin_panel_25", "$g_multiplayer_player_respawn_as_bot"),
        (else_try),
            (assign, "$g_presentation_obj_admin_panel_25", -1),
        (try_end),
        (try_begin),
            (eq, "$g_multiplayer_game_type", 6),
            (val_sub, ":var_1", ":var_2"),
            (create_text_overlay, reg0, "str_defender_spawn_count_limit", 0),
            (position_set_x, pos1, 0),
            (position_set_y, pos1, ":var_1"),
            (overlay_set_position, reg0, pos1),
            (create_combo_button_overlay, "$g_presentation_obj_admin_panel_27"),
            (position_set_x, pos1, 800),
            (position_set_y, pos1, 800),
            (overlay_set_size, "$g_presentation_obj_admin_panel_27", pos1),
            (position_set_x, pos1, 490),
            (position_set_y, pos1, ":var_1"),
            (overlay_set_position, "$g_presentation_obj_admin_panel_27", pos1),
            (assign, reg0, 5),
            (overlay_add_item, "$g_presentation_obj_admin_panel_27", "str_reg0"),
            (assign, reg0, 4),
            (overlay_add_item, "$g_presentation_obj_admin_panel_27", "str_reg0"),
            (assign, reg0, 3),
            (overlay_add_item, "$g_presentation_obj_admin_panel_27", "str_reg0"),
            (assign, reg0, 2),
            (overlay_add_item, "$g_presentation_obj_admin_panel_27", "str_reg0"),
            (assign, reg0, 1),
            (overlay_add_item, "$g_presentation_obj_admin_panel_27", "str_reg0"),
            (overlay_add_item, "$g_presentation_obj_admin_panel_27", "str_unlimited"),
            (store_sub, ":var_23", 5, "$g_multiplayer_number_of_respawn_count"),
            (overlay_set_val, "$g_presentation_obj_admin_panel_27", ":var_23"),
        (else_try),
            (assign, "$g_presentation_obj_admin_panel_27", -1),
        (try_end),
        (val_sub, ":var_1", ":var_2"),
        (create_text_overlay, reg0, "str_team_points_limit", 0),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg0, pos1),
        (create_number_box_overlay, "$g_presentation_obj_admin_panel_8", 3, 1001),
        (position_set_x, pos1, 390),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, "$g_presentation_obj_admin_panel_8", pos1),
        (overlay_set_val, "$g_presentation_obj_admin_panel_8", "$g_multiplayer_game_max_points"),
        (try_begin),
            (eq, "$g_multiplayer_game_type", 5),
            (val_sub, ":var_1", ":var_2"),
            (create_text_overlay, reg0, "str_point_gained_from_flags", 0),
            (position_set_x, pos1, 0),
            (position_set_y, pos1, ":var_1"),
            (overlay_set_position, reg0, pos1),
            (create_number_box_overlay, "$g_presentation_obj_admin_panel_17", 25, 401),
            (position_set_x, pos1, 390),
            (position_set_y, pos1, ":var_1"),
            (overlay_set_position, "$g_presentation_obj_admin_panel_17", pos1),
            (overlay_set_val, "$g_presentation_obj_admin_panel_17", "$g_multiplayer_point_gained_from_flags"),
        (else_try),
            (assign, "$g_presentation_obj_admin_panel_17", -1),
        (try_end),
        (try_begin),
            (eq, "$g_multiplayer_game_type", 4),
            (val_sub, ":var_1", ":var_2"),
            (create_text_overlay, reg0, "str_point_gained_from_capturing_flag", 0),
            (position_set_x, pos1, 0),
            (position_set_y, pos1, ":var_1"),
            (overlay_set_position, reg0, pos1),
            (create_number_box_overlay, "$g_presentation_obj_admin_panel_18", 0, 11),
            (position_set_x, pos1, 390),
            (position_set_y, pos1, ":var_1"),
            (overlay_set_position, "$g_presentation_obj_admin_panel_18", pos1),
            (overlay_set_val, "$g_presentation_obj_admin_panel_18", "$g_multiplayer_point_gained_from_capturing_flag"),
        (else_try),
            (assign, "$g_presentation_obj_admin_panel_18", -1),
        (try_end),
        (val_sub, ":var_1", ":var_2"),
        (create_text_overlay, reg0, "str_respawn_period", 0),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg0, pos1),
        (create_number_box_overlay, "$g_presentation_obj_admin_panel_6", 3, 31),
        (position_set_x, pos1, 390),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, "$g_presentation_obj_admin_panel_6", pos1),
        (overlay_set_val, "$g_presentation_obj_admin_panel_6", "$g_multiplayer_respawn_period"),
        (val_sub, ":var_1", ":var_2"),
        (create_text_overlay, reg0, "str_initial_gold_multiplier", 0),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg0, pos1),
        (create_number_box_overlay, "$g_presentation_obj_admin_panel_33", 0, 1001),
        (position_set_x, pos1, 390),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, "$g_presentation_obj_admin_panel_33", pos1),
        (overlay_set_val, "$g_presentation_obj_admin_panel_33", "$g_multiplayer_initial_gold_multiplier"),
        (val_sub, ":var_1", ":var_2"),
        (create_text_overlay, reg0, "str_battle_earnings_multiplier", 0),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg0, pos1),
        (create_number_box_overlay, "$g_presentation_obj_admin_panel_34", 0, 1001),
        (position_set_x, pos1, 390),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, "$g_presentation_obj_admin_panel_34", pos1),
        (overlay_set_val, "$g_presentation_obj_admin_panel_34", "$g_multiplayer_battle_earnings_multiplier"),
        (try_begin),
            (this_or_next|eq, "$g_multiplayer_game_type", 2),
            (this_or_next|eq, "$g_multiplayer_game_type", 3),
            (eq, "$g_multiplayer_game_type", 6),
            (val_sub, ":var_1", ":var_2"),
            (create_text_overlay, reg0, "str_round_earnings_multiplier", 0),
            (position_set_x, pos1, 0),
            (position_set_y, pos1, ":var_1"),
            (overlay_set_position, reg0, pos1),
            (create_number_box_overlay, "$g_presentation_obj_admin_panel_35", 0, 1001),
            (position_set_x, pos1, 390),
            (position_set_y, pos1, ":var_1"),
            (overlay_set_position, "$g_presentation_obj_admin_panel_35", pos1),
            (overlay_set_val, "$g_presentation_obj_admin_panel_35", "$g_multiplayer_round_earnings_multiplier"),
        (else_try),
            (assign, "$g_presentation_obj_admin_panel_35", -1),
        (try_end),
        (val_sub, ":var_1", ":var_2"),
        (create_text_overlay, reg0, "str_make_kick_voteable", 0),
        (position_set_x, pos1, 30),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg0, pos1),
        (create_check_box_overlay, "$g_presentation_obj_admin_panel_28", "mesh_checkbox_off", "mesh_checkbox_on"),
        (position_set_x, pos1, 7),
        (store_add, ":var_3", ":var_1", 7),
        (position_set_y, pos1, ":var_3"),
        (overlay_set_position, "$g_presentation_obj_admin_panel_28", pos1),
        (overlay_set_val, "$g_presentation_obj_admin_panel_28", "$g_multiplayer_kick_voteable"),
        (val_sub, ":var_1", ":var_2"),
        (create_text_overlay, reg0, "str_make_ban_voteable", 0),
        (position_set_x, pos1, 30),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg0, pos1),
        (create_check_box_overlay, "$g_presentation_obj_admin_panel_29", "mesh_checkbox_off", "mesh_checkbox_on"),
        (position_set_x, pos1, 7),
        (store_add, ":var_3", ":var_1", 7),
        (position_set_y, pos1, ":var_3"),
        (overlay_set_position, "$g_presentation_obj_admin_panel_29", pos1),
        (overlay_set_val, "$g_presentation_obj_admin_panel_29", "$g_multiplayer_ban_voteable"),
        (val_sub, ":var_1", ":var_2"),
        (create_text_overlay, reg0, "str_make_maps_voteable", 0),
        (position_set_x, pos1, 30),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg0, pos1),
        (create_check_box_overlay, "$g_presentation_obj_admin_panel_24", "mesh_checkbox_off", "mesh_checkbox_on"),
        (position_set_x, pos1, 7),
        (store_add, ":var_3", ":var_1", 7),
        (position_set_y, pos1, ":var_3"),
        (overlay_set_position, "$g_presentation_obj_admin_panel_24", pos1),
        (overlay_set_val, "$g_presentation_obj_admin_panel_24", "$g_multiplayer_maps_voteable"),
        (val_sub, ":var_1", ":var_2"),
        (create_text_overlay, reg0, "str_make_factions_voteable", 0),
        (position_set_x, pos1, 30),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg0, pos1),
        (create_check_box_overlay, "$g_presentation_obj_admin_panel_23", "mesh_checkbox_off", "mesh_checkbox_on"),
        (position_set_x, pos1, 7),
        (store_add, ":var_3", ":var_1", 7),
        (position_set_y, pos1, ":var_3"),
        (overlay_set_position, "$g_presentation_obj_admin_panel_23", pos1),
        (overlay_set_val, "$g_presentation_obj_admin_panel_23", "$g_multiplayer_factions_voteable"),
        (val_sub, ":var_1", ":var_2"),
        (create_text_overlay, reg0, "str_bots_upper_limit_for_votes", 0),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg0, pos1),
        (assign, ":var_24", 51),
        (val_min, ":var_24", "$g_multiplayer_max_num_bots"),
        (create_number_box_overlay, "$g_presentation_obj_admin_panel_22", 0, ":var_24"),
        (position_set_x, pos1, 390),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, "$g_presentation_obj_admin_panel_22", pos1),
        (overlay_set_val, "$g_presentation_obj_admin_panel_22", "$g_multiplayer_num_bots_voteable"),
        (val_sub, ":var_1", ":var_2"),
        (create_text_overlay, reg0, "str_valid_vote_ratio", 0),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg0, pos1),
        (create_number_box_overlay, "$g_presentation_obj_admin_panel_30", 50, 101),
        (position_set_x, pos1, 390),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, "$g_presentation_obj_admin_panel_30", pos1),
        (overlay_set_val, "$g_presentation_obj_admin_panel_30", "$g_multiplayer_valid_vote_ratio"),
        (val_sub, ":var_1", ":var_2"),
        (create_text_overlay, reg0, "str_auto_team_balance_limit", 0),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg0, pos1),
        (create_combo_button_overlay, "$g_presentation_obj_admin_panel_31"),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, "$g_presentation_obj_admin_panel_31", pos1),
        (position_set_x, pos1, 490),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, "$g_presentation_obj_admin_panel_31", pos1),
        (overlay_add_item, "$g_presentation_obj_admin_panel_31", "str_unlimited"),
        (assign, reg0, 6),
        (overlay_add_item, "$g_presentation_obj_admin_panel_31", "str_reg0"),
        (assign, reg0, 5),
        (overlay_add_item, "$g_presentation_obj_admin_panel_31", "str_reg0"),
        (assign, reg0, 4),
        (overlay_add_item, "$g_presentation_obj_admin_panel_31", "str_reg0"),
        (assign, reg0, 3),
        (overlay_add_item, "$g_presentation_obj_admin_panel_31", "str_reg0"),
        (assign, reg0, 2),
        (overlay_add_item, "$g_presentation_obj_admin_panel_31", "str_reg0"),
        (try_begin),
            (ge, "$g_multiplayer_auto_team_balance_limit", 1000),
            (overlay_set_val, "$g_presentation_obj_admin_panel_31", 0),
        (else_try),
            (store_sub, ":var_25", 7, "$g_multiplayer_auto_team_balance_limit"),
            (overlay_set_val, "$g_presentation_obj_admin_panel_31", ":var_25"),
        (try_end),
        (val_sub, ":var_1", ":var_2"),
        (create_text_overlay, reg0, "str_allow_player_banners", 0),
        (position_set_x, pos1, 30),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg0, pos1),
        (create_check_box_overlay, "$g_presentation_obj_admin_panel_39", "mesh_checkbox_off", "mesh_checkbox_on"),
        (position_set_x, pos1, 7),
        (store_add, ":var_3", ":var_1", 7),
        (position_set_y, pos1, ":var_3"),
        (overlay_set_position, "$g_presentation_obj_admin_panel_39", pos1),
        (overlay_set_val, "$g_presentation_obj_admin_panel_39", "$g_multiplayer_allow_player_banners"),
        (val_sub, ":var_1", ":var_2"),
        (create_text_overlay, reg0, "str_disallow_ranged_weapons", 0),
        (position_set_x, pos1, 30),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg0, pos1),
        (create_check_box_overlay, "$g_presentation_obj_admin_panel_42", "mesh_checkbox_off", "mesh_checkbox_on"),
        (position_set_x, pos1, 7),
        (store_add, ":var_3", ":var_1", 7),
        (position_set_y, pos1, ":var_3"),
        (overlay_set_position, "$g_presentation_obj_admin_panel_42", pos1),
        (overlay_set_val, "$g_presentation_obj_admin_panel_42", "$g_multiplayer_disallow_ranged_weapons"),
        (val_sub, ":var_1", ":var_2"),
        (create_text_overlay, reg0, "str_force_default_armor", 0),
        (position_set_x, pos1, 30),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg0, pos1),
        (create_check_box_overlay, "$g_presentation_obj_admin_panel_40", "mesh_checkbox_off", "mesh_checkbox_on"),
        (position_set_x, pos1, 7),
        (store_add, ":var_3", ":var_1", 7),
        (position_set_y, pos1, ":var_3"),
        (overlay_set_position, "$g_presentation_obj_admin_panel_40", pos1),
        (overlay_set_val, "$g_presentation_obj_admin_panel_40", "$g_multiplayer_force_default_armor"),
        (set_container_overlay, -1),
        (create_button_overlay, "$g_presentation_obj_admin_panel_13", "str_back", 16),
        (position_set_x, pos1, 825),
        (position_set_y, pos1, 50),
        (overlay_set_position, "$g_presentation_obj_admin_panel_13", pos1),
        (position_set_x, pos1, 1500),
        (position_set_y, pos1, 1500),
        (overlay_set_size, "$g_presentation_obj_admin_panel_13", pos1),
        (create_button_overlay, "$g_presentation_obj_admin_panel_2", "str_start_map", 16),
        (position_set_x, pos1, 825),
        (position_set_y, pos1, 90),
        (overlay_set_position, "$g_presentation_obj_admin_panel_2", pos1),
        (position_set_x, pos1, 1500),
        (position_set_y, pos1, 1500),
        (overlay_set_size, "$g_presentation_obj_admin_panel_2", pos1),
        (presentation_set_duration, 999999),
        (try_begin),
            (eq, ":var_9", 0),
            (assign, "$g_multiplayer_selected_map", ":var_8"),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_game_multiplayer_admin_panel"),
        (try_end),
    ]),
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":var_0"),
        (store_trigger_param_2, ":var_1"),
        (try_begin),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_1"),
            (store_add, ":var_2", ":var_1", 0),
            (troop_get_slot, "$g_multiplayer_selected_map", "trp_multiplayer_data", ":var_2"),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_game_multiplayer_admin_panel"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_2"),
            (multiplayer_send_2_int_to_server, 2, "$g_multiplayer_selected_map", "$g_multiplayer_game_type"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_3"),
            (multiplayer_send_2_int_to_server, 4, 1, ":var_1"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_4"),
            (multiplayer_send_2_int_to_server, 4, 2, ":var_1"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_5"),
            (multiplayer_send_int_to_server, 5, ":var_1"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_6"),
            (multiplayer_send_int_to_server, 9, ":var_1"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_7"),
            (multiplayer_send_int_to_server, 10, ":var_1"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_8"),
            (multiplayer_send_int_to_server, 12, ":var_1"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_9"),
            (multiplayer_send_string_to_server, 16, 0),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_10"),
            (assign, "$g_multiplayer_game_type", ":var_1"),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_game_multiplayer_admin_panel"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_11"),
            (store_add, "$g_multiplayer_next_team_1_faction", ":var_1", "fac_kingdom_1"),
            (multiplayer_send_2_int_to_server, 17, 1, "$g_multiplayer_next_team_1_faction"),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_game_multiplayer_admin_panel"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_12"),
            (store_add, "$g_multiplayer_next_team_2_faction", ":var_1", "fac_kingdom_1"),
            (multiplayer_send_2_int_to_server, 17, 2, "$g_multiplayer_next_team_2_faction"),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_game_multiplayer_admin_panel"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_13"),
            (presentation_set_duration, 0),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_14"),
            (multiplayer_send_int_to_server, 8, ":var_1"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_15"),
            (multiplayer_send_int_to_server, 7, ":var_1"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_16"),
            (multiplayer_send_int_to_server, 11, ":var_1"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_17"),
            (multiplayer_send_int_to_server, 13, ":var_1"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_18"),
            (multiplayer_send_int_to_server, 14, ":var_1"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_19"),
            (multiplayer_send_int_to_server, 6, ":var_1"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_20"),
            (multiplayer_send_string_to_server, 15, 0),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_21"),
            (multiplayer_send_int_to_server, 3, ":var_1"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_22"),
            (multiplayer_send_int_to_server, 25, ":var_1"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_23"),
            (multiplayer_send_int_to_server, 26, ":var_1"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_24"),
            (multiplayer_send_int_to_server, 27, ":var_1"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_25"),
            (multiplayer_send_int_to_server, 28, ":var_1"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_26"),
            (multiplayer_send_int_to_server, 29, ":var_1"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_27"),
            (store_sub, ":var_3", 5, ":var_1"),
            (multiplayer_send_int_to_server, 30, ":var_3"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_28"),
            (multiplayer_send_int_to_server, 31, ":var_1"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_29"),
            (multiplayer_send_int_to_server, 32, ":var_1"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_30"),
            (multiplayer_send_int_to_server, 33, ":var_1"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_31"),
            (try_begin),
                (eq, ":var_1", 0),
                (multiplayer_send_int_to_server, 34, 1000),
            (else_try),
                (store_sub, ":var_3", 7, ":var_1"),
                (multiplayer_send_int_to_server, 34, ":var_3"),
            (try_end),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_32"),
            (server_set_welcome_message, 0),
            (multiplayer_send_string_to_server, 35, 0),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_33"),
            (multiplayer_send_int_to_server, 36, ":var_1"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_34"),
            (multiplayer_send_int_to_server, 37, ":var_1"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_35"),
            (multiplayer_send_int_to_server, 38, ":var_1"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_36"),
            (multiplayer_send_int_to_server, 39, ":var_1"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_37"),
            (multiplayer_send_int_to_server, 40, ":var_1"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_38"),
            (multiplayer_send_int_to_server, 41, ":var_1"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_39"),
            (multiplayer_send_int_to_server, 42, ":var_1"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_40"),
            (multiplayer_send_int_to_server, 43, ":var_1"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_41"),
            (multiplayer_send_int_to_server, 44, ":var_1"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_admin_panel_42"),
            (multiplayer_send_int_to_server, 47, ":var_1"),
        (try_end),
    ]),
    (ti_on_presentation_run, [
        (try_begin),
            (key_clicked, key_escape),
            (presentation_set_duration, 0),
        (try_end),
    ]),
]),

("multiplayer_welcome_message", prsntf_manual_end_only, 0, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (str_store_welcome_message, s0),
        (try_begin),
            (neg|str_is_empty, 0),
            (eq, "$g_multiplayer_welcome_message_shown", 0),
            (create_mesh_overlay, reg0, "mesh_mp_ui_welcome_panel"),
            (position_set_x, pos1, 200),
            (position_set_y, pos1, 400),
            (overlay_set_position, reg0, pos1),
            (create_text_overlay, reg0, 0, 8192),
            (overlay_set_color, reg0, 16777215),
            (position_set_x, pos1, 230),
            (position_set_y, pos1, 425),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 540),
            (position_set_y, pos1, 150),
            (overlay_set_area_size, reg0, pos1),
            (presentation_set_duration, 999999),
        (else_try),
            (eq, "$g_multiplayer_show_server_rules", 1),
            (create_mesh_overlay, reg0, "mesh_mp_ui_welcome_panel"),
            (position_set_x, pos1, 200),
            (position_set_y, pos1, 400),
            (overlay_set_position, reg0, pos1),
            (try_begin),
                (neg|str_is_empty, 0),
                (str_clear, s3),
                (str_store_string, s2, 0),
                (str_store_string, s2, "str_s2_s3"),
                (str_store_string, s2, "str_s2_s3"),
            (else_try),
                (str_clear, s2),
            (try_end),
            (str_store_string, s3, "@Game Rules:^"),
            (str_store_string, s2, "str_s2_s3"),
            (assign, ":var_0", 1000),
            (call_script, "script_game_multiplayer_get_game_type_mission_template", "$g_multiplayer_game_type"),
            (assign, ":var_1", reg0),
            (str_store_server_name, s0),
            (str_store_string, s3, "str_server_name_s0"),
            (str_store_string, s2, "str_s2_s3"),
            (try_begin),
                (eq, "$g_multiplayer_game_type", 0),
                (str_store_string, s0, "str_multi_game_type_1"),
            (else_try),
                (eq, "$g_multiplayer_game_type", 1),
                (str_store_string, s0, "str_multi_game_type_2"),
            (else_try),
                (eq, "$g_multiplayer_game_type", 2),
                (str_store_string, s0, "str_multi_game_type_3"),
            (else_try),
                (eq, "$g_multiplayer_game_type", 3),
                (str_store_string, s0, "str_multi_game_type_4"),
            (else_try),
                (eq, "$g_multiplayer_game_type", 4),
                (str_store_string, s0, "str_multi_game_type_5"),
            (else_try),
                (eq, "$g_multiplayer_game_type", 5),
                (str_store_string, s0, "str_multi_game_type_6"),
            (else_try),
                (eq, "$g_multiplayer_game_type", 6),
                (str_store_string, s0, "str_multi_game_type_7"),
            (else_try),
                (eq, "$g_multiplayer_game_type", 7),
                (str_store_string, s0, "str_multi_game_type_8"),
            (try_end),
            (str_store_string, s3, "str_game_type_s0"),
            (str_store_string, s2, "str_s2_s3"),
            (store_current_scene, ":var_2"),
            (val_sub, ":var_2", "scn_multi_scene_1"),
            (val_add, ":var_2", "str_multi_scene_1"),
            (str_store_string, s0, ":var_2"),
            (str_store_string, s3, "str_map_name_s0"),
            (str_store_string, s2, "str_s2_s3"),
            (store_mission_timer_a, ":var_3"),
            (val_add, ":var_3", "$server_mission_timer_while_player_joined"),
            (assign, reg0, ":var_3"),
            (store_mul, "$g_multiplayer_game_max_seconds", "$g_multiplayer_game_max_minutes", 60),
            (store_sub, ":var_4", "$g_multiplayer_game_max_seconds", ":var_3"),
            (store_div, reg0, ":var_4", 60),
            (store_mod, reg1, ":var_4", 60),
            (try_begin),
                (ge, reg0, 10),
                (ge, reg1, 10),
                (str_clear, s0),
                (str_clear, s1),
            (else_try),
                (ge, reg0, 10),
                (str_clear, s0),
                (str_store_string, s1, "@0"),
            (else_try),
                (ge, reg1, 10),
                (str_store_string, s0, "@0"),
                (str_clear, s1),
            (else_try),
                (str_store_string, s0, "@0"),
                (str_store_string, s1, "@0"),
            (try_end),
            (str_store_string, s3, "str_remaining_time_s0reg0_s1reg1"),
            (str_store_string, s2, "str_s2_s3"),
            (try_for_range, ":var_5", 0, ":var_0"),
                (assign, reg0, -12345),
                (call_script, "script_game_get_multiplayer_server_option_for_mission_template", ":var_1", ":var_5"),
                (try_begin),
                    (eq, reg0, -12345),
                    (assign, ":var_0", 0),
                (else_try),
                    (call_script, "script_game_multiplayer_server_option_for_mission_template_to_string", ":var_1", ":var_5", reg0),
                    (str_store_string, s3, 0),
                    (str_store_string, s2, "str_s2_s3"),
                (try_end),
            (try_end),
            (create_text_overlay, reg0, 2, 8192),
            (overlay_set_color, reg0, 16777215),
            (position_set_x, pos1, 230),
            (position_set_y, pos1, 425),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 540),
            (position_set_y, pos1, 150),
            (overlay_set_area_size, reg0, pos1),
            (presentation_set_duration, 999999),
        (try_end),
    ]),
    (ti_on_presentation_run, [
        (str_store_welcome_message, s0),
        (try_begin),
            (neg|eq, "$g_multiplayer_show_server_rules", 1),
            (this_or_next|str_is_empty, 0),
            (eq, "$g_multiplayer_welcome_message_shown", 1),
            (presentation_set_duration, 0),
            (neg|is_presentation_active, "prsnt_multiplayer_escape_menu"),
            (neg|is_presentation_active, "prsnt_multiplayer_team_select"),
            (start_presentation, "prsnt_multiplayer_team_select"),
        (else_try),
            (store_mission_timer_a, ":var_0"),
            (gt, ":var_0", 1),
            (this_or_next|key_clicked, key_escape),
            (this_or_next|key_clicked, key_space),
            (this_or_next|key_clicked, key_enter),
            (this_or_next|key_clicked, key_left_mouse_button),
            (key_clicked, key_right_mouse_button),
            (assign, "$g_multiplayer_welcome_message_shown", 1),
            (presentation_set_duration, 0),
            (neg|is_presentation_active, "prsnt_multiplayer_escape_menu"),
            (neg|is_presentation_active, "prsnt_multiplayer_team_select"),
            (try_begin),
                (eq, "$g_multiplayer_show_server_rules", 1),
                (assign, "$g_multiplayer_show_server_rules", 0),
                (start_presentation, "prsnt_multiplayer_escape_menu"),
            (else_try),
                (start_presentation, "prsnt_multiplayer_team_select"),
            (try_end),
        (try_end),
    ]),
]),

("multiplayer_team_select", prsntf_manual_end_only, 0, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (create_mesh_overlay, reg0, "mesh_mp_ingame_menu"),
        (position_set_x, pos1, 250),
        (position_set_y, pos1, 80),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1000),
        (position_set_y, pos1, 1000),
        (overlay_set_size, reg0, pos1),
        (str_clear, s0),
        (create_text_overlay, "$g_presentation_obj_team_select_container", 0, 131072),
        (position_set_x, pos1, 285),
        (position_set_y, pos1, 125),
        (overlay_set_position, "$g_presentation_obj_team_select_container", pos1),
        (position_set_x, pos1, 405),
        (position_set_y, pos1, 500),
        (overlay_set_area_size, "$g_presentation_obj_team_select_container", pos1),
        (set_container_overlay, "$g_presentation_obj_team_select_container"),
        (assign, ":var_0", 450),
        (create_text_overlay, reg0, "str_choose_a_faction", 0),
        (overlay_set_color, reg0, 16777215),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, ":var_0"),
        (overlay_set_position, reg0, pos1),
        (val_sub, ":var_0", 40),
        (position_set_y, pos1, ":var_0"),
        (position_set_x, pos1, 100),
        (multiplayer_get_my_player, ":var_1"),
        (team_get_faction, ":var_2", 0),
        (str_store_faction_name, s0, ":var_2"),
        (create_button_overlay, "$g_presentation_obj_team_select_1", 0, 0),
        (try_begin),
            (call_script, "script_cf_multiplayer_team_is_available", ":var_1", 0),
            (overlay_set_color, "$g_presentation_obj_team_select_1", 16777215),
            (overlay_set_hilight_color, "$g_presentation_obj_team_select_1", 5635920),
            (assign, "$g_multiplayer_team_select_1_available", 1),
        (else_try),
            (overlay_set_color, "$g_presentation_obj_team_select_1", 8947848),
            (overlay_set_hilight_color, "$g_presentation_obj_team_select_1", 8947848),
            (assign, "$g_multiplayer_team_select_1_available", 0),
        (try_end),
        (position_set_y, pos1, ":var_0"),
        (overlay_set_position, "$g_presentation_obj_team_select_1", pos1),
        (val_sub, ":var_0", 40),
        (position_set_y, pos1, ":var_0"),
        (team_get_faction, ":var_2", 1),
        (str_store_faction_name, s0, ":var_2"),
        (create_button_overlay, "$g_presentation_obj_team_select_2", 0, 0),
        (try_begin),
            (call_script, "script_cf_multiplayer_team_is_available", ":var_1", 1),
            (overlay_set_color, "$g_presentation_obj_team_select_2", 16777215),
            (overlay_set_hilight_color, "$g_presentation_obj_team_select_2", 5635920),
            (assign, "$g_multiplayer_team_select_2_available", 1),
        (else_try),
            (overlay_set_color, "$g_presentation_obj_team_select_2", 8947848),
            (overlay_set_hilight_color, "$g_presentation_obj_team_select_2", 8947848),
            (assign, "$g_multiplayer_team_select_2_available", 0),
        (try_end),
        (overlay_set_position, "$g_presentation_obj_team_select_2", pos1),
        (val_sub, ":var_0", 40),
        (position_set_y, pos1, ":var_0"),
        (create_button_overlay, "$g_presentation_obj_team_select_3", "str_spectator", 0),
        (overlay_set_color, "$g_presentation_obj_team_select_3", 16777215),
        (overlay_set_position, "$g_presentation_obj_team_select_3", pos1),
        (val_sub, ":var_0", 40),
        (position_set_y, pos1, ":var_0"),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":var_0"),
        (multiplayer_get_my_player, ":var_1"),
        (try_begin),
            (eq, "$g_waiting_for_confirmation_to_terminate", 0),
            (try_begin),
                (eq, ":var_0", "$g_presentation_obj_team_select_1"),
                (try_begin),
                    (call_script, "script_cf_multiplayer_team_is_available", ":var_1", 0),
                    (try_begin),
                        (player_get_team_no, ":var_2", ":var_1"),
                        (neg|eq, ":var_2", 0),
                        (assign, "$g_confirmation_result", 0),
                        (assign, "$g_waiting_for_confirmation_to_terminate", 1),
                        (player_get_troop_id, "$g_confirmation_troop_backup", ":var_1"),
                        (player_get_team_no, "$g_confirmation_team_backup", ":var_1"),
                        (player_set_troop_id, ":var_1", -1),
                        (multiplayer_send_int_to_server, 19, 0),
                        (player_set_team_no, ":var_1", 0),
                    (else_try),
                        (presentation_set_duration, 0),
                        (start_presentation, "prsnt_multiplayer_troop_select"),
                    (try_end),
                (try_end),
            (else_try),
                (eq, ":var_0", "$g_presentation_obj_team_select_2"),
                (try_begin),
                    (call_script, "script_cf_multiplayer_team_is_available", ":var_1", 1),
                    (try_begin),
                        (player_get_team_no, ":var_2", ":var_1"),
                        (neg|eq, ":var_2", 1),
                        (assign, "$g_confirmation_result", 0),
                        (assign, "$g_waiting_for_confirmation_to_terminate", 1),
                        (player_get_troop_id, "$g_confirmation_troop_backup", ":var_1"),
                        (player_get_team_no, "$g_confirmation_team_backup", ":var_1"),
                        (player_set_troop_id, ":var_1", -1),
                        (multiplayer_send_int_to_server, 19, 1),
                        (player_set_team_no, ":var_1", 1),
                    (else_try),
                        (presentation_set_duration, 0),
                        (start_presentation, "prsnt_multiplayer_troop_select"),
                    (try_end),
                (try_end),
            (else_try),
                (eq, ":var_0", "$g_presentation_obj_team_select_3"),
                (player_set_troop_id, ":var_1", -1),
                (multiplayer_send_int_to_server, 19, 2),
                (player_set_team_no, ":var_1", 2),
                (presentation_set_duration, 0),
            (try_end),
        (try_end),
    ]),
    (ti_on_presentation_run, [
        (multiplayer_get_my_player, ":var_0"),
        (try_begin),
            (key_clicked, key_escape),
            (eq, "$g_waiting_for_confirmation_to_terminate", 0),
            (multiplayer_get_my_team, ":var_1"),
            (try_begin),
                (eq, ":var_1", 3),
                (player_set_troop_id, ":var_0", -1),
                (multiplayer_send_int_to_server, 19, 2),
                (player_set_team_no, ":var_0", 2),
            (try_end),
            (presentation_set_duration, 0),
        (else_try),
            (eq, "$g_waiting_for_confirmation_to_terminate", 1),
            (eq, "$g_confirmation_result", 1),
            (assign, "$g_waiting_for_confirmation_to_terminate", 0),
            (assign, "$g_confirmation_result", 0),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_multiplayer_troop_select"),
        (else_try),
            (eq, "$g_waiting_for_confirmation_to_terminate", 1),
            (eq, "$g_confirmation_result", -1),
            (player_set_troop_id, ":var_0", "$g_confirmation_troop_backup"),
            (player_set_team_no, ":var_0", "$g_confirmation_team_backup"),
            (assign, "$g_waiting_for_confirmation_to_terminate", 0),
            (assign, "$g_confirmation_result", 0),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_multiplayer_team_select"),
        (else_try),
            (assign, ":var_2", 0),
            (try_begin),
                (call_script, "script_cf_multiplayer_team_is_available", ":var_0", 0),
                (try_begin),
                    (eq, "$g_multiplayer_team_select_1_available", 0),
                    (assign, ":var_2", 1),
                (try_end),
            (else_try),
                (try_begin),
                    (eq, "$g_multiplayer_team_select_1_available", 1),
                    (assign, ":var_2", 1),
                (try_end),
            (try_end),
            (try_begin),
                (call_script, "script_cf_multiplayer_team_is_available", ":var_0", 1),
                (try_begin),
                    (eq, "$g_multiplayer_team_select_2_available", 0),
                    (assign, ":var_2", 1),
                (try_end),
            (else_try),
                (try_begin),
                    (eq, "$g_multiplayer_team_select_2_available", 1),
                    (assign, ":var_2", 1),
                (try_end),
            (try_end),
            (eq, ":var_2", 1),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_multiplayer_team_select"),
        (try_end),
    ]),
]),

("multiplayer_troop_select", prsntf_manual_end_only, 0, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (create_mesh_overlay, reg0, "mesh_mp_ingame_menu"),
        (position_set_x, pos1, 250),
        (position_set_y, pos1, 80),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1000),
        (position_set_y, pos1, 1000),
        (overlay_set_size, reg0, pos1),
        (str_clear, s0),
        (create_text_overlay, "$g_presentation_obj_troop_select_container", 0, 131072),
        (position_set_x, pos1, 285),
        (position_set_y, pos1, 125),
        (overlay_set_position, "$g_presentation_obj_troop_select_container", pos1),
        (position_set_x, pos1, 405),
        (position_set_y, pos1, 500),
        (overlay_set_area_size, "$g_presentation_obj_troop_select_container", pos1),
        (set_container_overlay, "$g_presentation_obj_troop_select_container"),
        (assign, ":var_0", 450),
        (create_text_overlay, reg0, "str_choose_a_troop", 0),
        (overlay_set_color, reg0, 16777215),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, ":var_0"),
        (overlay_set_position, reg0, pos1),
        (val_sub, ":var_0", 40),
        (position_set_y, pos1, ":var_0"),
        (position_set_x, pos1, 100),
        (multiplayer_get_my_player, ":var_1"),
        (player_get_team_no, ":var_2", ":var_1"),
        (team_get_faction, ":var_3", ":var_2"),
        (try_for_range, ":var_4", 30, 46),
            (troop_set_slot, "trp_multiplayer_data", ":var_4", -1),
        (try_end),
        (assign, ":var_5", 0),
        (try_for_range, ":var_6", "trp_sarleon_longbowman_multiplayer", "trp_multiplayer_end"),
            (store_troop_faction, ":var_7", ":var_6"),
            (eq, ":var_7", ":var_3"),
            (str_store_troop_name, s1, ":var_6"),
            (create_button_overlay, reg0, 1, 0),
            (overlay_set_color, reg0, 16777215),
            (store_add, ":var_8", ":var_5", 30),
            (troop_set_slot, "trp_multiplayer_data", ":var_8", reg0),
            (position_set_y, pos1, ":var_0"),
            (overlay_set_position, reg0, pos1),
            (val_sub, ":var_0", 40),
            (position_set_y, pos1, ":var_0"),
            (val_add, ":var_5", 1),
        (try_end),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":var_0"),
        (multiplayer_get_my_player, ":var_1"),
        (player_get_team_no, ":var_2", ":var_1"),
        (team_get_faction, ":var_3", ":var_2"),
        (assign, ":var_4", -1),
        (assign, ":var_5", 46),
        (try_for_range, ":var_6", 30, ":var_5"),
            (troop_slot_eq, "trp_multiplayer_data", ":var_6", ":var_0"),
            (store_sub, ":var_7", ":var_6", 30),
            (assign, ":var_8", "trp_multiplayer_end"),
            (try_for_range, ":var_9", "trp_sarleon_longbowman_multiplayer", ":var_8"),
                (store_troop_faction, ":var_10", ":var_9"),
                (eq, ":var_10", ":var_3"),
                (val_sub, ":var_7", 1),
                (neg|ge, ":var_7", 0),
                (assign, ":var_4", ":var_9"),
                (assign, ":var_8", 0),
            (try_end),
            (try_begin),
                (multiplayer_get_my_troop, ":var_9"),
                (neg|eq, ":var_9", ":var_4"),
                (player_set_troop_id, ":var_1", ":var_4"),
                (multiplayer_send_int_to_server, 20, ":var_4"),
                (call_script, "script_multiplayer_set_default_item_selections_for_troop", ":var_4"),
                (call_script, "script_multiplayer_send_item_selections"),
            (try_end),
            (presentation_set_duration, 0),
            (assign, "$g_presentation_state", 0),
            (start_presentation, "prsnt_multiplayer_item_select"),
            (assign, ":var_5", 0),
        (try_end),
    ]),
    (ti_on_presentation_run, [
        (try_begin),
            (key_clicked, key_escape),
            (multiplayer_get_my_player, ":var_0"),
            (is_between, ":var_0", 0, 1000),
            (multiplayer_get_my_troop, ":var_1"),
            (try_begin),
                (neg|is_between, ":var_1", "trp_sarleon_longbowman_multiplayer", "trp_multiplayer_end"),
                (player_set_troop_id, ":var_0", -1),
                (multiplayer_send_int_to_server, 20, -1),
                (multiplayer_send_int_to_server, 19, 2),
                (player_set_team_no, ":var_0", 2),
            (try_end),
            (presentation_set_duration, 0),
        (try_end),
    ]),
]),

("multiplayer_item_select", prsntf_manual_end_only, 0, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (multiplayer_get_my_player, ":var_0"),
        (assign, "$g_presentation_obj_item_select_1", -1),
        (assign, "$g_presentation_obj_item_select_2", -1),
        (assign, "$g_presentation_obj_item_select_3", -1),
        (assign, "$g_presentation_obj_item_select_4", -1),
        (assign, "$g_presentation_obj_item_select_5", -1),
        (assign, "$g_presentation_obj_item_select_6", -1),
        (assign, "$g_presentation_obj_item_select_7", -1),
        (assign, "$g_presentation_obj_item_select_8", -1),
        (assign, "$g_presentation_obj_item_select_9", -1),
        (assign, "$g_presentation_obj_item_select_10", -1),
        (assign, "$g_presentation_obj_item_select_11", -1),
        (assign, "$g_presentation_obj_item_select_12", -1),
        (assign, "$g_presentation_obj_item_select_13", -1),
        (assign, "$g_presentation_obj_item_select_14", -1),
        (assign, "$g_presentation_obj_item_select_15", -1),
        (assign, "$g_presentation_obj_item_select_16", -1),
        (try_begin),
            (neg|eq, "$g_current_opened_item_details", -1),
            (close_item_details),
            (assign, "$g_current_opened_item_details", -1),
        (try_end),
        (store_add, ":var_1", 2, 0),
        (player_get_slot, ":var_2", ":var_0", ":var_1"),
        (try_begin),
            (ge, ":var_2", 0),
            (create_image_button_overlay, "$g_presentation_obj_item_select_1", "mesh_mp_inventory_slot_empty", "mesh_mp_inventory_slot_empty"),
            (create_mesh_overlay_with_item_id, reg0, ":var_2"),
            (position_set_x, pos1, 950),
            (position_set_y, pos1, 526),
            (overlay_set_position, reg0, pos1),
            (assign, "$g_inside_obj_1", reg0),
        (else_try),
            (create_image_button_overlay, "$g_presentation_obj_item_select_1", "mesh_mp_inventory_slot_equip", "mesh_mp_inventory_slot_equip"),
        (try_end),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, "$g_presentation_obj_item_select_1", pos1),
        (position_set_x, pos1, 899),
        (position_set_y, pos1, 475),
        (overlay_set_position, "$g_presentation_obj_item_select_1", pos1),
        (store_add, ":var_1", 2, 1),
        (player_get_slot, ":var_2", ":var_0", ":var_1"),
        (try_begin),
            (ge, ":var_2", 0),
            (create_image_button_overlay, "$g_presentation_obj_item_select_2", "mesh_mp_inventory_slot_empty", "mesh_mp_inventory_slot_empty"),
            (create_mesh_overlay_with_item_id, reg0, ":var_2"),
            (position_set_x, pos1, 950),
            (position_set_y, pos1, 426),
            (overlay_set_position, reg0, pos1),
            (assign, "$g_inside_obj_2", reg0),
        (else_try),
            (create_image_button_overlay, "$g_presentation_obj_item_select_2", "mesh_mp_inventory_slot_equip", "mesh_mp_inventory_slot_equip"),
        (try_end),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, "$g_presentation_obj_item_select_2", pos1),
        (position_set_x, pos1, 899),
        (position_set_y, pos1, 375),
        (overlay_set_position, "$g_presentation_obj_item_select_2", pos1),
        (store_add, ":var_1", 2, 2),
        (player_get_slot, ":var_2", ":var_0", ":var_1"),
        (try_begin),
            (ge, ":var_2", 0),
            (create_image_button_overlay, "$g_presentation_obj_item_select_3", "mesh_mp_inventory_slot_empty", "mesh_mp_inventory_slot_empty"),
            (create_mesh_overlay_with_item_id, reg0, ":var_2"),
            (position_set_x, pos1, 950),
            (position_set_y, pos1, 326),
            (overlay_set_position, reg0, pos1),
            (assign, "$g_inside_obj_3", reg0),
        (else_try),
            (create_image_button_overlay, "$g_presentation_obj_item_select_3", "mesh_mp_inventory_slot_equip", "mesh_mp_inventory_slot_equip"),
        (try_end),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, "$g_presentation_obj_item_select_3", pos1),
        (position_set_x, pos1, 899),
        (position_set_y, pos1, 275),
        (overlay_set_position, "$g_presentation_obj_item_select_3", pos1),
        (store_add, ":var_1", 2, 3),
        (player_get_slot, ":var_2", ":var_0", ":var_1"),
        (try_begin),
            (ge, ":var_2", 0),
            (create_image_button_overlay, "$g_presentation_obj_item_select_4", "mesh_mp_inventory_slot_empty", "mesh_mp_inventory_slot_empty"),
            (create_mesh_overlay_with_item_id, reg0, ":var_2"),
            (position_set_x, pos1, 950),
            (position_set_y, pos1, 226),
            (overlay_set_position, reg0, pos1),
            (assign, "$g_inside_obj_4", reg0),
        (else_try),
            (create_image_button_overlay, "$g_presentation_obj_item_select_4", "mesh_mp_inventory_slot_equip", "mesh_mp_inventory_slot_equip"),
        (try_end),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, "$g_presentation_obj_item_select_4", pos1),
        (position_set_x, pos1, 899),
        (position_set_y, pos1, 175),
        (overlay_set_position, "$g_presentation_obj_item_select_4", pos1),
        (store_add, ":var_1", 2, 4),
        (player_get_slot, ":var_2", ":var_0", ":var_1"),
        (try_begin),
            (ge, ":var_2", 0),
            (create_image_button_overlay, "$g_presentation_obj_item_select_5", "mesh_mp_inventory_slot_empty", "mesh_mp_inventory_slot_empty"),
            (create_mesh_overlay_with_item_id, reg0, ":var_2"),
            (position_set_x, pos1, 53),
            (position_set_y, pos1, 576),
            (overlay_set_position, reg0, pos1),
            (assign, "$g_inside_obj_5", reg0),
        (else_try),
            (create_image_button_overlay, "$g_presentation_obj_item_select_5", "mesh_mp_inventory_slot_helmet", "mesh_mp_inventory_slot_helmet"),
        (try_end),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, "$g_presentation_obj_item_select_5", pos1),
        (position_set_x, pos1, 2),
        (position_set_y, pos1, 525),
        (overlay_set_position, "$g_presentation_obj_item_select_5", pos1),
        (store_add, ":var_1", 2, 5),
        (player_get_slot, ":var_2", ":var_0", ":var_1"),
        (try_begin),
            (ge, ":var_2", 0),
            (create_image_button_overlay, "$g_presentation_obj_item_select_6", "mesh_mp_inventory_slot_empty", "mesh_mp_inventory_slot_empty"),
            (create_mesh_overlay_with_item_id, reg0, ":var_2"),
            (position_set_x, pos1, 53),
            (position_set_y, pos1, 476),
            (overlay_set_position, reg0, pos1),
            (assign, "$g_inside_obj_6", reg0),
        (else_try),
            (create_image_button_overlay, "$g_presentation_obj_item_select_6", "mesh_mp_inventory_slot_armor", "mesh_mp_inventory_slot_armor"),
        (try_end),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, "$g_presentation_obj_item_select_6", pos1),
        (position_set_x, pos1, 2),
        (position_set_y, pos1, 425),
        (overlay_set_position, "$g_presentation_obj_item_select_6", pos1),
        (store_add, ":var_1", 2, 6),
        (player_get_slot, ":var_2", ":var_0", ":var_1"),
        (try_begin),
            (ge, ":var_2", 0),
            (create_image_button_overlay, "$g_presentation_obj_item_select_7", "mesh_mp_inventory_slot_empty", "mesh_mp_inventory_slot_empty"),
            (create_mesh_overlay_with_item_id, reg0, ":var_2"),
            (position_set_x, pos1, 53),
            (position_set_y, pos1, 376),
            (overlay_set_position, reg0, pos1),
            (assign, "$g_inside_obj_7", reg0),
        (else_try),
            (create_image_button_overlay, "$g_presentation_obj_item_select_7", "mesh_mp_inventory_slot_boot", "mesh_mp_inventory_slot_boot"),
        (try_end),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, "$g_presentation_obj_item_select_7", pos1),
        (position_set_x, pos1, 2),
        (position_set_y, pos1, 325),
        (overlay_set_position, "$g_presentation_obj_item_select_7", pos1),
        (store_add, ":var_1", 2, 7),
        (player_get_slot, ":var_2", ":var_0", ":var_1"),
        (try_begin),
            (ge, ":var_2", 0),
            (create_image_button_overlay, "$g_presentation_obj_item_select_8", "mesh_mp_inventory_slot_empty", "mesh_mp_inventory_slot_empty"),
            (create_mesh_overlay_with_item_id, reg0, ":var_2"),
            (position_set_x, pos1, 53),
            (position_set_y, pos1, 276),
            (overlay_set_position, reg0, pos1),
            (assign, "$g_inside_obj_8", reg0),
        (else_try),
            (create_image_button_overlay, "$g_presentation_obj_item_select_8", "mesh_mp_inventory_slot_glove", "mesh_mp_inventory_slot_glove"),
        (try_end),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, "$g_presentation_obj_item_select_8", pos1),
        (position_set_x, pos1, 2),
        (position_set_y, pos1, 225),
        (overlay_set_position, "$g_presentation_obj_item_select_8", pos1),
        (store_add, ":var_1", 2, 8),
        (player_get_slot, ":var_2", ":var_0", ":var_1"),
        (try_begin),
            (ge, ":var_2", 0),
            (eq, "$g_horses_are_avaliable", 1),
            (create_image_button_overlay, "$g_presentation_obj_item_select_9", "mesh_mp_inventory_slot_empty", "mesh_mp_inventory_slot_empty"),
            (create_mesh_overlay_with_item_id, reg0, ":var_2"),
            (position_set_x, pos1, 53),
            (position_set_y, pos1, 176),
            (overlay_set_position, reg0, pos1),
            (assign, "$g_inside_obj_9", reg0),
        (else_try),
            (create_image_button_overlay, "$g_presentation_obj_item_select_9", "mesh_mp_inventory_slot_horse", "mesh_mp_inventory_slot_horse"),
        (try_end),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, "$g_presentation_obj_item_select_9", pos1),
        (position_set_x, pos1, 2),
        (position_set_y, pos1, 125),
        (overlay_set_position, "$g_presentation_obj_item_select_9", pos1),
        (create_mesh_overlay, reg0, "mesh_mp_inventory_left"),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg0, pos1),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, 14),
        (overlay_set_position, reg0, pos1),
        (create_mesh_overlay, reg0, "mesh_mp_inventory_right"),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg0, pos1),
        (position_set_x, pos1, 894),
        (position_set_y, pos1, 65),
        (overlay_set_position, reg0, pos1),
        (create_in_game_button_overlay, "$g_presentation_obj_item_select_10", "str_reset_to_default", 0),
        (overlay_set_color, "$g_presentation_obj_item_select_10", 16777215),
        (position_set_x, pos1, 605),
        (position_set_y, pos1, 25),
        (overlay_set_position, "$g_presentation_obj_item_select_10", pos1),
        (create_in_game_button_overlay, "$g_presentation_obj_item_select_11", "str_done", 0),
        (overlay_set_color, "$g_presentation_obj_item_select_11", 16777215),
        (position_set_x, pos1, 395),
        (position_set_y, pos1, 25),
        (overlay_set_position, "$g_presentation_obj_item_select_11", pos1),
        (assign, ":var_3", 725),
        (multiplayer_get_my_player, ":var_0"),
        (player_get_team_no, ":var_4", ":var_0"),
        (assign, ":var_5", 0),
        (try_begin),
            (eq, ":var_4", 0),
            (try_begin),
                (gt, "$g_multiplayer_num_bots_team_1", 0),
                (assign, ":var_5", 1),
            (try_end),
        (else_try),
            (try_begin),
                (gt, "$g_multiplayer_num_bots_team_2", 0),
                (assign, ":var_5", 1),
            (try_end),
        (try_end),
        (team_get_faction, ":var_6", ":var_4"),
        (try_begin),
            (eq, ":var_5", 1),
            (neg|eq, "$g_multiplayer_game_type", 0),
            (neg|eq, "$g_multiplayer_game_type", 7),
            (assign, ":var_7", 0),
            (try_begin),
                (eq, ":var_5", 1),
                (try_for_range, ":var_8", "trp_sarleon_longbowman_multiplayer_ai", "trp_sarleon_longbowman_multiplayer"),
                    (store_troop_faction, ":var_9", ":var_8"),
                    (eq, ":var_9", ":var_6"),
                    (val_add, ":var_7", 1),
                (try_end),
            (try_end),
            (store_mul, ":var_10", ":var_7", 20),
            (val_add, ":var_10", 40),
            (create_mesh_overlay, reg0, "mesh_mp_ui_command_border_r"),
            (position_set_x, pos1, 280),
            (position_set_y, pos1, 680),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 2500),
            (position_set_y, pos1, 2500),
            (overlay_set_size, reg0, pos1),
            (create_mesh_overlay, reg0, "mesh_mp_ui_command_border_l"),
            (position_set_x, pos1, 650),
            (position_set_y, pos1, 680),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 2500),
            (position_set_y, pos1, 2500),
            (overlay_set_size, reg0, pos1),
            (create_mesh_overlay, reg0, "mesh_mp_ui_command_panel"),
            (position_set_x, pos1, 350),
            (store_sub, ":var_11", 750, ":var_10"),
            (position_set_y, pos1, ":var_11"),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 3000),
            (position_set_y, pos1, 3000),
            (overlay_set_size, reg0, pos1),
            (create_text_overlay, reg0, "str_command", 0),
            (overlay_set_color, reg0, 16777215),
            (position_set_x, pos1, 800),
            (position_set_y, pos1, 800),
            (overlay_set_size, reg0, pos1),
            (position_set_x, pos1, 370),
            (position_set_y, pos1, ":var_3"),
            (overlay_set_position, reg0, pos1),
            (val_sub, ":var_3", 20),
            (assign, ":var_12", 0),
            (try_for_range, ":var_8", "trp_sarleon_longbowman_multiplayer_ai", "trp_sarleon_longbowman_multiplayer"),
                (store_troop_faction, ":var_9", ":var_8"),
                (eq, ":var_9", ":var_6"),
                (create_check_box_overlay, reg0, "mesh_checkbox_off", "mesh_checkbox_on"),
                (position_set_x, pos1, 800),
                (position_set_y, pos1, 800),
                (overlay_set_size, reg0, pos1),
                (position_set_x, pos1, 377),
                (store_add, ":var_13", ":var_3", 2),
                (position_set_y, pos1, ":var_13"),
                (overlay_set_position, reg0, pos1),
                (try_begin),
                    (eq, ":var_12", 0),
                    (overlay_set_val, reg0, "$g_multiplayer_bot_type_1_wanted"),
                    (assign, "$g_presentation_obj_item_select_13", reg0),
                (else_try),
                    (eq, ":var_12", 1),
                    (overlay_set_val, reg0, "$g_multiplayer_bot_type_2_wanted"),
                    (assign, "$g_presentation_obj_item_select_14", reg0),
                (else_try),
                    (eq, ":var_12", 2),
                    (overlay_set_val, reg0, "$g_multiplayer_bot_type_3_wanted"),
                    (assign, "$g_presentation_obj_item_select_15", reg0),
                (else_try),
                    (overlay_set_val, reg0, "$g_multiplayer_bot_type_4_wanted"),
                    (assign, "$g_presentation_obj_item_select_16", reg0),
                (try_end),
                (str_store_troop_name, s0, ":var_8"),
                (create_text_overlay, reg0, "str_s0", 0),
                (overlay_set_color, reg0, 16777215),
                (position_set_x, pos1, 800),
                (position_set_y, pos1, 800),
                (overlay_set_size, reg0, pos1),
                (position_set_x, pos1, 397),
                (position_set_y, pos1, ":var_3"),
                (overlay_set_position, reg0, pos1),
                (val_sub, ":var_3", 20),
                (val_add, ":var_12", 1),
            (try_end),
            (val_sub, ":var_3", 20),
        (try_end),
        (multiplayer_get_my_player, ":var_0"),
        (player_get_gold, ":var_14", ":var_0"),
        (call_script, "script_multiplayer_calculate_cur_selected_items_cost", ":var_0", 1),
        (create_text_overlay, "$g_presentation_obj_item_select_12", "str_total_item_cost_reg0", 98308),
        (try_begin),
            (ge, ":var_14", reg0),
            (overlay_set_color, "$g_presentation_obj_item_select_12", 16777215),
        (else_try),
            (overlay_set_color, "$g_presentation_obj_item_select_12", 16711680),
        (try_end),
        (position_set_x, pos1, 680),
        (position_set_y, pos1, 652),
        (overlay_set_position, "$g_presentation_obj_item_select_12", pos1),
        (store_add, "$g_presentation_obj_item_select_next", "$g_presentation_obj_item_select_12", 1),
        (player_get_troop_id, ":var_15", ":var_0"),
        (try_begin),
            (eq, "$g_presentation_state", 1),
            (call_script, "script_multiplayer_display_available_items_for_troop_and_item_classes", ":var_15", 1, 18, 781, 474),
            (create_mesh_overlay, reg0, "mesh_mp_inventory_right_arrow"),
            (position_set_x, pos1, 800),
            (position_set_y, pos1, 800),
            (overlay_set_size, reg0, pos1),
            (position_set_x, pos1, 881),
            (position_set_y, pos1, 515),
            (overlay_set_position, reg0, pos1),
        (else_try),
            (eq, "$g_presentation_state", 2),
            (call_script, "script_multiplayer_display_available_items_for_troop_and_item_classes", ":var_15", 1, 18, 781, 374),
            (create_mesh_overlay, reg0, "mesh_mp_inventory_right_arrow"),
            (position_set_x, pos1, 800),
            (position_set_y, pos1, 800),
            (overlay_set_size, reg0, pos1),
            (position_set_x, pos1, 881),
            (position_set_y, pos1, 415),
            (overlay_set_position, reg0, pos1),
        (else_try),
            (eq, "$g_presentation_state", 3),
            (call_script, "script_multiplayer_display_available_items_for_troop_and_item_classes", ":var_15", 1, 18, 781, 274),
            (create_mesh_overlay, reg0, "mesh_mp_inventory_right_arrow"),
            (position_set_x, pos1, 800),
            (position_set_y, pos1, 800),
            (overlay_set_size, reg0, pos1),
            (position_set_x, pos1, 881),
            (position_set_y, pos1, 315),
            (overlay_set_position, reg0, pos1),
        (else_try),
            (eq, "$g_presentation_state", 4),
            (call_script, "script_multiplayer_display_available_items_for_troop_and_item_classes", ":var_15", 1, 18, 781, 174),
            (create_mesh_overlay, reg0, "mesh_mp_inventory_right_arrow"),
            (position_set_x, pos1, 800),
            (position_set_y, pos1, 800),
            (overlay_set_size, reg0, pos1),
            (position_set_x, pos1, 881),
            (position_set_y, pos1, 215),
            (overlay_set_position, reg0, pos1),
        (else_try),
            (eq, "$g_presentation_state", 5),
            (call_script, "script_multiplayer_display_available_items_for_troop_and_item_classes", ":var_15", 22, 24, 117, 524),
            (create_mesh_overlay, reg0, "mesh_mp_inventory_left_arrow"),
            (position_set_x, pos1, 800),
            (position_set_y, pos1, 800),
            (overlay_set_size, reg0, pos1),
            (position_set_x, pos1, 106),
            (position_set_y, pos1, 565),
            (overlay_set_position, reg0, pos1),
        (else_try),
            (eq, "$g_presentation_state", 6),
            (call_script, "script_multiplayer_display_available_items_for_troop_and_item_classes", ":var_15", 19, 22, 117, 424),
            (create_mesh_overlay, reg0, "mesh_mp_inventory_left_arrow"),
            (position_set_x, pos1, 800),
            (position_set_y, pos1, 800),
            (overlay_set_size, reg0, pos1),
            (position_set_x, pos1, 106),
            (position_set_y, pos1, 465),
            (overlay_set_position, reg0, pos1),
        (else_try),
            (eq, "$g_presentation_state", 7),
            (call_script, "script_multiplayer_display_available_items_for_troop_and_item_classes", ":var_15", 24, 26, 117, 324),
            (create_mesh_overlay, reg0, "mesh_mp_inventory_left_arrow"),
            (position_set_x, pos1, 800),
            (position_set_y, pos1, 800),
            (overlay_set_size, reg0, pos1),
            (position_set_x, pos1, 106),
            (position_set_y, pos1, 365),
            (overlay_set_position, reg0, pos1),
        (else_try),
            (eq, "$g_presentation_state", 8),
            (call_script, "script_multiplayer_display_available_items_for_troop_and_item_classes", ":var_15", 26, 27, 117, 224),
            (create_mesh_overlay, reg0, "mesh_mp_inventory_left_arrow"),
            (position_set_x, pos1, 800),
            (position_set_y, pos1, 800),
            (overlay_set_size, reg0, pos1),
            (position_set_x, pos1, 106),
            (position_set_y, pos1, 265),
            (overlay_set_position, reg0, pos1),
        (else_try),
            (eq, "$g_presentation_state", 9),
            (eq, "$g_horses_are_avaliable", 1),
            (call_script, "script_multiplayer_display_available_items_for_troop_and_item_classes", ":var_15", 18, 19, 117, 124),
            (create_mesh_overlay, reg0, "mesh_mp_inventory_left_arrow"),
            (position_set_x, pos1, 800),
            (position_set_y, pos1, 800),
            (overlay_set_size, reg0, pos1),
            (position_set_x, pos1, 106),
            (position_set_y, pos1, 165),
            (overlay_set_position, reg0, pos1),
        (try_end),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_mouse_enter_leave, [
        (store_trigger_param_1, ":var_0"),
        (store_trigger_param_2, ":var_1"),
        (try_begin),
            (eq, "$g_close_equipment_selection", 0),
            (try_begin),
                (eq, ":var_1", 0),
                (assign, ":var_2", -1),
                (try_begin),
                    (ge, ":var_0", "$g_presentation_obj_item_select_next"),
                    (store_sub, ":var_3", ":var_0", "$g_presentation_obj_item_select_next"),
                    (store_mod, ":var_4", ":var_3", 2),
                    (store_sub, ":var_4", 1, ":var_4"),
                    (val_div, ":var_3", 2),
                    (store_add, ":var_5", 46, ":var_3"),
                    (troop_get_slot, ":var_2", "trp_multiplayer_data", ":var_5"),
                    (assign, ":var_6", ":var_0"),
                    (val_add, ":var_6", ":var_4"),
                (else_try),
                    (eq, ":var_0", "$g_presentation_obj_item_select_1"),
                    (store_add, ":var_7", 2, 1),
                    (val_sub, ":var_7", 1),
                    (multiplayer_get_my_player, ":var_8"),
                    (player_get_slot, ":var_2", ":var_8", ":var_7"),
                    (assign, ":var_6", "$g_inside_obj_1"),
                (else_try),
                    (eq, ":var_0", "$g_presentation_obj_item_select_2"),
                    (store_add, ":var_7", 2, 2),
                    (val_sub, ":var_7", 1),
                    (multiplayer_get_my_player, ":var_8"),
                    (player_get_slot, ":var_2", ":var_8", ":var_7"),
                    (assign, ":var_6", "$g_inside_obj_2"),
                (else_try),
                    (eq, ":var_0", "$g_presentation_obj_item_select_3"),
                    (store_add, ":var_7", 2, 3),
                    (val_sub, ":var_7", 1),
                    (multiplayer_get_my_player, ":var_8"),
                    (player_get_slot, ":var_2", ":var_8", ":var_7"),
                    (assign, ":var_6", "$g_inside_obj_3"),
                (else_try),
                    (eq, ":var_0", "$g_presentation_obj_item_select_4"),
                    (store_add, ":var_7", 2, 4),
                    (val_sub, ":var_7", 1),
                    (multiplayer_get_my_player, ":var_8"),
                    (player_get_slot, ":var_2", ":var_8", ":var_7"),
                    (assign, ":var_6", "$g_inside_obj_4"),
                (else_try),
                    (eq, ":var_0", "$g_presentation_obj_item_select_5"),
                    (store_add, ":var_7", 2, 5),
                    (val_sub, ":var_7", 1),
                    (multiplayer_get_my_player, ":var_8"),
                    (player_get_slot, ":var_2", ":var_8", ":var_7"),
                    (assign, ":var_6", "$g_inside_obj_5"),
                (else_try),
                    (eq, ":var_0", "$g_presentation_obj_item_select_6"),
                    (store_add, ":var_7", 2, 6),
                    (val_sub, ":var_7", 1),
                    (multiplayer_get_my_player, ":var_8"),
                    (player_get_slot, ":var_2", ":var_8", ":var_7"),
                    (assign, ":var_6", "$g_inside_obj_6"),
                (else_try),
                    (eq, ":var_0", "$g_presentation_obj_item_select_7"),
                    (store_add, ":var_7", 2, 7),
                    (val_sub, ":var_7", 1),
                    (multiplayer_get_my_player, ":var_8"),
                    (player_get_slot, ":var_2", ":var_8", ":var_7"),
                    (assign, ":var_6", "$g_inside_obj_7"),
                (else_try),
                    (eq, ":var_0", "$g_presentation_obj_item_select_8"),
                    (store_add, ":var_7", 2, 8),
                    (val_sub, ":var_7", 1),
                    (multiplayer_get_my_player, ":var_8"),
                    (player_get_slot, ":var_2", ":var_8", ":var_7"),
                    (assign, ":var_6", "$g_inside_obj_8"),
                (else_try),
                    (eq, ":var_0", "$g_presentation_obj_item_select_9"),
                    (eq, "$g_horses_are_avaliable", 1),
                    (store_add, ":var_7", 2, 9),
                    (val_sub, ":var_7", 1),
                    (multiplayer_get_my_player, ":var_8"),
                    (player_get_slot, ":var_2", ":var_8", ":var_7"),
                    (assign, ":var_6", "$g_inside_obj_9"),
                (try_end),
                (try_begin),
                    (ge, ":var_2", 0),
                    (overlay_get_position, 0, ":var_6"),
                    (multiplayer_get_my_player, ":var_8"),
                    (player_get_troop_id, ":var_9", ":var_8"),
                    (try_begin),
                        (call_script, "script_cf_multiplayer_is_item_default_for_troop", ":var_2", ":var_9"),
                        (show_item_details, ":var_2", pos0, 0),
                    (else_try),
                        (store_troop_faction, ":var_10", ":var_9"),
                        (store_sub, ":var_11", ":var_10", "fac_kingdom_1"),
                        (val_add, ":var_11", 30),
                        (item_get_slot, ":var_12", ":var_2", ":var_11"),
                        (show_item_details, ":var_2", pos0, ":var_12"),
                    (try_end),
                    (assign, "$g_current_opened_item_details", ":var_2"),
                (try_end),
            (else_try),
                (assign, ":var_2", -1),
                (try_begin),
                    (ge, ":var_0", "$g_presentation_obj_item_select_next"),
                    (store_sub, ":var_3", ":var_0", "$g_presentation_obj_item_select_next"),
                    (val_div, ":var_3", 2),
                    (store_add, ":var_5", 46, ":var_3"),
                    (troop_get_slot, ":var_2", "trp_multiplayer_data", ":var_5"),
                (else_try),
                    (eq, ":var_0", "$g_presentation_obj_item_select_1"),
                    (store_add, ":var_7", 2, 1),
                    (val_sub, ":var_7", 1),
                    (multiplayer_get_my_player, ":var_8"),
                    (player_get_slot, ":var_2", ":var_8", ":var_7"),
                    (assign, ":var_6", "$g_inside_obj_1"),
                (else_try),
                    (eq, ":var_0", "$g_presentation_obj_item_select_2"),
                    (store_add, ":var_7", 2, 2),
                    (val_sub, ":var_7", 1),
                    (multiplayer_get_my_player, ":var_8"),
                    (player_get_slot, ":var_2", ":var_8", ":var_7"),
                    (assign, ":var_6", "$g_inside_obj_2"),
                (else_try),
                    (eq, ":var_0", "$g_presentation_obj_item_select_3"),
                    (store_add, ":var_7", 2, 3),
                    (val_sub, ":var_7", 1),
                    (multiplayer_get_my_player, ":var_8"),
                    (player_get_slot, ":var_2", ":var_8", ":var_7"),
                    (assign, ":var_6", "$g_inside_obj_3"),
                (else_try),
                    (eq, ":var_0", "$g_presentation_obj_item_select_4"),
                    (store_add, ":var_7", 2, 4),
                    (val_sub, ":var_7", 1),
                    (multiplayer_get_my_player, ":var_8"),
                    (player_get_slot, ":var_2", ":var_8", ":var_7"),
                    (assign, ":var_6", "$g_inside_obj_4"),
                (else_try),
                    (eq, ":var_0", "$g_presentation_obj_item_select_5"),
                    (store_add, ":var_7", 2, 5),
                    (val_sub, ":var_7", 1),
                    (multiplayer_get_my_player, ":var_8"),
                    (player_get_slot, ":var_2", ":var_8", ":var_7"),
                    (assign, ":var_6", "$g_inside_obj_5"),
                (else_try),
                    (eq, ":var_0", "$g_presentation_obj_item_select_6"),
                    (store_add, ":var_7", 2, 6),
                    (val_sub, ":var_7", 1),
                    (multiplayer_get_my_player, ":var_8"),
                    (player_get_slot, ":var_2", ":var_8", ":var_7"),
                    (assign, ":var_6", "$g_inside_obj_6"),
                (else_try),
                    (eq, ":var_0", "$g_presentation_obj_item_select_7"),
                    (store_add, ":var_7", 2, 7),
                    (val_sub, ":var_7", 1),
                    (multiplayer_get_my_player, ":var_8"),
                    (player_get_slot, ":var_2", ":var_8", ":var_7"),
                    (assign, ":var_6", "$g_inside_obj_7"),
                (else_try),
                    (eq, ":var_0", "$g_presentation_obj_item_select_8"),
                    (store_add, ":var_7", 2, 8),
                    (val_sub, ":var_7", 1),
                    (multiplayer_get_my_player, ":var_8"),
                    (player_get_slot, ":var_2", ":var_8", ":var_7"),
                    (assign, ":var_6", "$g_inside_obj_8"),
                (else_try),
                    (eq, ":var_0", "$g_presentation_obj_item_select_9"),
                    (eq, "$g_horses_are_avaliable", 1),
                    (store_add, ":var_7", 2, 9),
                    (val_sub, ":var_7", 1),
                    (multiplayer_get_my_player, ":var_8"),
                    (player_get_slot, ":var_2", ":var_8", ":var_7"),
                    (assign, ":var_6", "$g_inside_obj_9"),
                (try_end),
                (try_begin),
                    (eq, "$g_current_opened_item_details", ":var_2"),
                    (close_item_details),
                    (assign, "$g_current_opened_item_details", -1),
                (try_end),
            (try_end),
        (else_try),
            (assign, "$g_close_equipment_selection", 0),
            (presentation_set_duration, 0),
        (try_end),
    ]),
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":var_0"),
        (store_trigger_param_2, ":var_1"),
        (multiplayer_get_my_player, ":var_2"),
        (player_get_troop_id, ":var_3", ":var_2"),
        (try_begin),
            (eq, "$g_close_equipment_selection", 0),
            (try_begin),
                (eq, "$g_presentation_state", 0),
                (try_begin),
                    (eq, ":var_0", "$g_presentation_obj_item_select_1"),
                    (assign, "$g_presentation_state", 1),
                    (presentation_set_duration, 0),
                    (start_presentation, "prsnt_multiplayer_item_select"),
                (else_try),
                    (eq, ":var_0", "$g_presentation_obj_item_select_2"),
                    (assign, "$g_presentation_state", 2),
                    (presentation_set_duration, 0),
                    (start_presentation, "prsnt_multiplayer_item_select"),
                (else_try),
                    (eq, ":var_0", "$g_presentation_obj_item_select_3"),
                    (assign, "$g_presentation_state", 3),
                    (presentation_set_duration, 0),
                    (start_presentation, "prsnt_multiplayer_item_select"),
                (else_try),
                    (eq, ":var_0", "$g_presentation_obj_item_select_4"),
                    (assign, "$g_presentation_state", 4),
                    (presentation_set_duration, 0),
                    (start_presentation, "prsnt_multiplayer_item_select"),
                (else_try),
                    (eq, ":var_0", "$g_presentation_obj_item_select_5"),
                    (assign, "$g_presentation_state", 5),
                    (presentation_set_duration, 0),
                    (start_presentation, "prsnt_multiplayer_item_select"),
                (else_try),
                    (eq, ":var_0", "$g_presentation_obj_item_select_6"),
                    (assign, "$g_presentation_state", 6),
                    (presentation_set_duration, 0),
                    (start_presentation, "prsnt_multiplayer_item_select"),
                (else_try),
                    (eq, ":var_0", "$g_presentation_obj_item_select_7"),
                    (assign, "$g_presentation_state", 7),
                    (presentation_set_duration, 0),
                    (start_presentation, "prsnt_multiplayer_item_select"),
                (else_try),
                    (eq, ":var_0", "$g_presentation_obj_item_select_8"),
                    (assign, "$g_presentation_state", 8),
                    (presentation_set_duration, 0),
                    (start_presentation, "prsnt_multiplayer_item_select"),
                (else_try),
                    (eq, ":var_0", "$g_presentation_obj_item_select_9"),
                    (eq, "$g_horses_are_avaliable", 1),
                    (assign, "$g_presentation_state", 9),
                    (presentation_set_duration, 0),
                    (start_presentation, "prsnt_multiplayer_item_select"),
                (try_end),
            (else_try),
                (gt, "$g_presentation_state", 0),
                (store_sub, ":var_4", ":var_0", "$g_presentation_obj_item_select_next"),
                (val_div, ":var_4", 2),
                (assign, ":var_5", 146),
                (try_for_range, ":var_6", 46, ":var_5"),
                    (neg|troop_slot_eq, "trp_multiplayer_data", ":var_6", -1),
                    (store_sub, ":var_7", ":var_6", 46),
                    (eq, ":var_4", ":var_7"),
                    (troop_get_slot, ":var_8", "trp_multiplayer_data", ":var_6"),
                    (store_add, ":var_9", 2, "$g_presentation_state"),
                    (val_sub, ":var_9", 1),
                    (player_set_slot, ":var_2", ":var_9", ":var_8"),
                    (player_get_gold, ":var_10", ":var_2"),
                    (call_script, "script_multiplayer_calculate_cur_selected_items_cost", ":var_2", 1),
                    (overlay_set_text, "$g_presentation_obj_item_select_12", "str_total_item_cost_reg0"),
                    (try_begin),
                        (ge, ":var_10", reg0),
                        (overlay_set_color, "$g_presentation_obj_item_select_12", 16777215),
                    (else_try),
                        (overlay_set_color, "$g_presentation_obj_item_select_12", 16711680),
                    (try_end),
                    (assign, ":var_5", 0),
                (try_end),
                (presentation_set_duration, 0),
                (assign, "$g_presentation_state", 0),
                (start_presentation, "prsnt_multiplayer_item_select"),
            (try_end),
            (try_begin),
                (eq, ":var_0", "$g_presentation_obj_item_select_10"),
                (call_script, "script_multiplayer_set_default_item_selections_for_troop", ":var_3"),
                (presentation_set_duration, 0),
                (assign, "$g_presentation_state", 0),
                (start_presentation, "prsnt_multiplayer_item_select"),
            (else_try),
                (eq, ":var_0", "$g_presentation_obj_item_select_11"),
                (call_script, "script_multiplayer_send_item_selections"),
                (presentation_set_duration, 0),
                (try_begin),
                    (try_begin),
                        (eq, "$g_multiplayer_game_type", 6),
                        (gt, "$g_multiplayer_number_of_respawn_count", 0),
                        (ge, "$g_my_spawn_count", "$g_multiplayer_number_of_respawn_count"),
                        (multiplayer_get_my_player, ":var_2"),
                        (player_get_team_no, ":var_11", ":var_2"),
                        (this_or_next|eq, ":var_11", 0),
                        (ge, "$g_my_spawn_count", 999),
                        (assign, "$g_show_no_more_respawns_remained", 1),
                    (else_try),
                        (assign, "$g_show_no_more_respawns_remained", 0),
                    (try_end),
                    (eq, "$g_show_no_more_respawns_remained", 1),
                    (store_mission_timer_a, "$g_multiplayer_respawn_start_time"),
                    (start_presentation, "prsnt_multiplayer_respawn_time_counter"),
                (try_end),
            (else_try),
                (eq, ":var_0", "$g_presentation_obj_item_select_13"),
                (assign, "$g_multiplayer_bot_type_1_wanted", ":var_1"),
                (multiplayer_send_2_int_to_server, 1, 35, ":var_1"),
            (else_try),
                (eq, ":var_0", "$g_presentation_obj_item_select_14"),
                (assign, "$g_multiplayer_bot_type_2_wanted", ":var_1"),
                (multiplayer_send_2_int_to_server, 1, 36, ":var_1"),
            (else_try),
                (eq, ":var_0", "$g_presentation_obj_item_select_15"),
                (assign, "$g_multiplayer_bot_type_3_wanted", ":var_1"),
                (multiplayer_send_2_int_to_server, 1, 37, ":var_1"),
            (else_try),
                (eq, ":var_0", "$g_presentation_obj_item_select_16"),
                (assign, "$g_multiplayer_bot_type_4_wanted", ":var_1"),
                (multiplayer_send_2_int_to_server, 1, 38, ":var_1"),
            (try_end),
        (else_try),
            (assign, "$g_close_equipment_selection", 0),
            (presentation_set_duration, 0),
        (try_end),
    ]),
    (ti_on_presentation_mouse_press, [
        (store_trigger_param_1, ":var_0"),
        (store_trigger_param_2, ":var_1"),
        (try_begin),
            (eq, "$g_close_equipment_selection", 0),
            (try_begin),
                (eq, ":var_1", 1),
                (try_begin),
                    (eq, "$g_presentation_state", 0),
                    (multiplayer_get_my_player, ":var_2"),
                    (try_begin),
                        (eq, ":var_0", "$g_presentation_obj_item_select_1"),
                        (store_add, ":var_3", 2, 0),
                        (player_set_slot, ":var_2", ":var_3", -1),
                        (presentation_set_duration, 0),
                        (assign, "$g_presentation_state", 0),
                        (start_presentation, "prsnt_multiplayer_item_select"),
                    (else_try),
                        (eq, ":var_0", "$g_presentation_obj_item_select_2"),
                        (store_add, ":var_3", 2, 1),
                        (player_set_slot, ":var_2", ":var_3", -1),
                        (presentation_set_duration, 0),
                        (assign, "$g_presentation_state", 0),
                        (start_presentation, "prsnt_multiplayer_item_select"),
                    (else_try),
                        (eq, ":var_0", "$g_presentation_obj_item_select_3"),
                        (store_add, ":var_3", 2, 2),
                        (player_set_slot, ":var_2", ":var_3", -1),
                        (presentation_set_duration, 0),
                        (assign, "$g_presentation_state", 0),
                        (start_presentation, "prsnt_multiplayer_item_select"),
                    (else_try),
                        (eq, ":var_0", "$g_presentation_obj_item_select_4"),
                        (store_add, ":var_3", 2, 3),
                        (player_set_slot, ":var_2", ":var_3", -1),
                        (presentation_set_duration, 0),
                        (assign, "$g_presentation_state", 0),
                        (start_presentation, "prsnt_multiplayer_item_select"),
                    (else_try),
                        (eq, ":var_0", "$g_presentation_obj_item_select_5"),
                        (store_add, ":var_3", 2, 4),
                        (player_set_slot, ":var_2", ":var_3", -1),
                        (presentation_set_duration, 0),
                        (assign, "$g_presentation_state", 0),
                        (start_presentation, "prsnt_multiplayer_item_select"),
                    (else_try),
                        (eq, ":var_0", "$g_presentation_obj_item_select_6"),
                        (store_add, ":var_3", 2, 5),
                        (player_set_slot, ":var_2", ":var_3", -1),
                        (presentation_set_duration, 0),
                        (assign, "$g_presentation_state", 0),
                        (start_presentation, "prsnt_multiplayer_item_select"),
                    (else_try),
                        (eq, ":var_0", "$g_presentation_obj_item_select_7"),
                        (store_add, ":var_3", 2, 6),
                        (player_set_slot, ":var_2", ":var_3", -1),
                        (presentation_set_duration, 0),
                        (assign, "$g_presentation_state", 0),
                        (start_presentation, "prsnt_multiplayer_item_select"),
                    (else_try),
                        (eq, ":var_0", "$g_presentation_obj_item_select_8"),
                        (store_add, ":var_3", 2, 7),
                        (player_set_slot, ":var_2", ":var_3", -1),
                        (presentation_set_duration, 0),
                        (assign, "$g_presentation_state", 0),
                        (start_presentation, "prsnt_multiplayer_item_select"),
                    (else_try),
                        (eq, ":var_0", "$g_presentation_obj_item_select_9"),
                        (eq, "$g_horses_are_avaliable", 1),
                        (store_add, ":var_3", 2, 8),
                        (player_set_slot, ":var_2", ":var_3", -1),
                        (presentation_set_duration, 0),
                        (assign, "$g_presentation_state", 0),
                        (start_presentation, "prsnt_multiplayer_item_select"),
                    (try_end),
                (else_try),
                    (gt, "$g_presentation_state", 0),
                    (presentation_set_duration, 0),
                    (assign, "$g_presentation_state", 0),
                    (start_presentation, "prsnt_multiplayer_item_select"),
                (try_end),
            (try_end),
        (else_try),
            (assign, "$g_close_equipment_selection", 0),
            (presentation_set_duration, 0),
        (try_end),
    ]),
    (ti_on_presentation_run, [
        (store_trigger_param_1, ":var_0"),
        (try_begin),
            (eq, "$g_close_equipment_selection", 0),
            (try_begin),
                (key_clicked, key_escape),
                (try_begin),
                    (neg|eq, "$g_current_opened_item_details", -1),
                    (close_item_details),
                    (assign, "$g_current_opened_item_details", -1),
                (try_end),
                (gt, ":var_0", 200),
                (presentation_set_duration, 0),
            (try_end),
        (else_try),
            (assign, "$g_close_equipment_selection", 0),
            (presentation_set_duration, 0),
        (try_end),
    ]),
]),

("multiplayer_message_1", prsntf_manual_end_only|prsntf_read_only, 0, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (try_begin),
            (eq, "$g_multiplayer_message_type", 12),
            (assign, ":var_0", "$g_multiplayer_message_value_1"),
            (try_begin),
                (eq, ":var_0", -1),
                (assign, ":var_1", 4294967295),
                (str_store_string, s0, "str_round_draw_no_one_remained"),
            (else_try),
                (try_begin),
                    (eq, ":var_0", 0),
                    (assign, ":var_1", 4281589009),
                (else_try),
                    (assign, ":var_1", 4294919202),
                (try_end),
                (try_begin),
                    (neg|ge, "$my_team_at_start_of_round", 2),
                    (try_begin),
                        (eq, "$my_team_at_start_of_round", ":var_0"),
                        (assign, ":var_1", 4281589009),
                    (else_try),
                        (assign, ":var_1", 4294919202),
                    (try_end),
                (try_end),
                (team_get_faction, ":var_2", ":var_0"),
                (str_store_faction_name, s1, ":var_2"),
                (str_store_string, s0, "str_s1_won_round"),
            (try_end),
            (create_text_overlay, "$g_multiplayer_message_1", 0, 65552),
            (overlay_set_color, "$g_multiplayer_message_1", ":var_1"),
            (try_begin),
                (neg|eq, ":var_0", -1),
                (position_set_x, pos1, 375),
            (else_try),
                (position_set_x, pos1, 400),
            (try_end),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 400),
            (overlay_set_position, "$g_multiplayer_message_1", pos1),
            (position_set_x, pos1, 2000),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_multiplayer_message_1", pos1),
            (presentation_set_duration, 300),
        (else_try),
            (eq, "$g_multiplayer_message_type", 4),
            (agent_get_team, ":var_0", "$g_multiplayer_message_value_1"),
            (team_get_faction, ":var_3", ":var_0"),
            (str_store_faction_name, s1, ":var_3"),
            (try_begin),
                (eq, ":var_0", 0),
                (assign, ":var_1", 4281589009),
            (else_try),
                (assign, ":var_1", 4294919202),
            (try_end),
            (multiplayer_get_my_player, ":var_4"),
            (try_begin),
                (ge, ":var_4", 0),
                (player_get_agent_id, ":var_5", ":var_4"),
                (try_begin),
                    (ge, ":var_5", 0),
                    (agent_get_team, ":var_6", ":var_5"),
                    (try_begin),
                        (eq, ":var_6", ":var_0"),
                        (assign, ":var_1", 4281589009),
                        (play_sound, "snd_team_scored_a_point"),
                    (else_try),
                        (assign, ":var_1", 4294919202),
                        (play_sound, "snd_enemy_scored_a_point"),
                    (try_end),
                (try_end),
            (try_end),
            (str_store_string, s0, "str_s1_captured_flag"),
            (create_text_overlay, "$g_multiplayer_message_1", 0, 65552),
            (overlay_set_color, "$g_multiplayer_message_1", ":var_1"),
            (position_set_x, pos1, 350),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 400),
            (overlay_set_position, "$g_multiplayer_message_1", pos1),
            (position_set_x, pos1, 2000),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_multiplayer_message_1", pos1),
            (presentation_set_duration, 400),
        (else_try),
            (eq, "$g_multiplayer_message_type", 5),
            (try_begin),
                (ge, "$g_multiplayer_message_value_1", 0),
                (agent_get_team, ":var_7", "$g_multiplayer_message_value_1"),
                (team_get_faction, ":var_8", ":var_7"),
                (str_store_faction_name, s1, ":var_8"),
                (str_store_string, s0, "str_s1_returned_flag"),
            (else_try),
                (val_add, "$g_multiplayer_message_value_1", 1),
                (val_mul, "$g_multiplayer_message_value_1", -1),
                (assign, ":var_7", "$g_multiplayer_message_value_1"),
                (team_get_faction, ":var_8", ":var_7"),
                (str_store_faction_name, s1, ":var_8"),
                (str_store_string, s0, "str_s1_auto_returned_flag"),
            (try_end),
            (multiplayer_get_my_player, ":var_4"),
            (try_begin),
                (ge, ":var_4", 0),
                (player_get_agent_id, ":var_5", ":var_4"),
                (try_begin),
                    (ge, ":var_5", 0),
                    (play_sound, "snd_flag_returned"),
                (try_end),
            (try_end),
            (assign, ":var_1", 4294967295),
            (create_text_overlay, "$g_multiplayer_message_1", 0, 65552),
            (overlay_set_color, "$g_multiplayer_message_1", ":var_1"),
            (position_set_x, pos1, 325),
            (position_set_y, pos1, 400),
            (position_set_x, pos1, 500),
            (overlay_set_position, "$g_multiplayer_message_1", pos1),
            (position_set_x, pos1, 2000),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_multiplayer_message_1", pos1),
            (presentation_set_duration, 400),
        (else_try),
            (eq, "$g_multiplayer_message_type", 6),
            (agent_get_team, ":var_9", "$g_multiplayer_message_value_1"),
            (team_get_faction, ":var_10", ":var_9"),
            (str_store_faction_name, s1, ":var_10"),
            (assign, ":var_1", 4294967295),
            (multiplayer_get_my_player, ":var_4"),
            (try_begin),
                (ge, ":var_4", 0),
                (player_get_agent_id, ":var_5", ":var_4"),
                (try_begin),
                    (ge, ":var_5", 0),
                    (agent_get_team, ":var_6", ":var_5"),
                    (try_begin),
                        (eq, ":var_6", ":var_9"),
                        (play_sound, "snd_enemy_flag_taken"),
                    (else_try),
                        (play_sound, "snd_your_flag_taken"),
                    (try_end),
                (try_end),
            (try_end),
            (str_store_string, s0, "str_s1_taken_flag"),
            (create_text_overlay, "$g_multiplayer_message_1", 0, 65552),
            (overlay_set_color, "$g_multiplayer_message_1", ":var_1"),
            (position_set_x, pos1, 365),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 400),
            (overlay_set_position, "$g_multiplayer_message_1", pos1),
            (position_set_x, pos1, 2000),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_multiplayer_message_1", pos1),
            (presentation_set_duration, 400),
        (else_try),
            (eq, "$g_multiplayer_message_type", 9),
            (store_div, ":var_0", "$g_multiplayer_message_value_1", 100),
            (store_mod, reg0, "$g_multiplayer_message_value_1", 100),
            (val_sub, ":var_0", 1),
            (try_begin),
                (eq, ":var_0", 0),
                (assign, ":var_1", 4281589009),
            (else_try),
                (assign, ":var_1", 4294919202),
            (try_end),
            (multiplayer_get_my_player, ":var_4"),
            (try_begin),
                (ge, ":var_4", 0),
                (player_get_agent_id, ":var_5", ":var_4"),
                (try_begin),
                    (ge, ":var_5", 0),
                    (agent_get_team, ":var_6", ":var_5"),
                    (try_begin),
                        (eq, ":var_6", ":var_0"),
                        (assign, ":var_1", 4281589009),
                        (play_sound, "snd_team_scored_a_point"),
                    (else_try),
                        (assign, ":var_1", 4294919202),
                        (play_sound, "snd_enemy_scored_a_point"),
                    (try_end),
                (try_end),
            (try_end),
            (team_get_faction, ":var_3", ":var_0"),
            (str_store_faction_name, s1, ":var_3"),
            (str_store_string, s0, "str_s1_captured_flag_reg0"),
            (create_text_overlay, "$g_multiplayer_message_1", 0, 65552),
            (overlay_set_color, "$g_multiplayer_message_1", ":var_1"),
            (position_set_x, pos1, 345),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 400),
            (overlay_set_position, "$g_multiplayer_message_1", pos1),
            (position_set_x, pos1, 2000),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_multiplayer_message_1", pos1),
            (presentation_set_duration, 400),
        (else_try),
            (eq, "$g_multiplayer_message_type", 10),
            (store_div, ":var_0", "$g_multiplayer_message_value_1", 100),
            (store_mod, reg0, "$g_multiplayer_message_value_1", 100),
            (val_sub, ":var_0", 1),
            (multiplayer_get_my_player, ":var_4"),
            (try_begin),
                (ge, ":var_4", 0),
                (player_get_agent_id, ":var_5", ":var_4"),
                (try_begin),
                    (ge, ":var_5", 0),
                    (agent_get_team, ":var_6", ":var_5"),
                    (try_begin),
                        (eq, ":var_6", ":var_0"),
                        (play_sound, "snd_enemy_flag_taken"),
                    (else_try),
                        (play_sound, "snd_your_flag_taken"),
                    (try_end),
                (try_end),
            (try_end),
            (assign, ":var_1", 4294967295),
            (team_get_faction, ":var_3", ":var_0"),
            (str_store_faction_name, s1, ":var_3"),
            (str_store_string, s0, "str_s1_pulling_flag_reg0"),
            (create_text_overlay, "$g_multiplayer_message_1", 0, 65552),
            (overlay_set_color, "$g_multiplayer_message_1", ":var_1"),
            (position_set_x, pos1, 345),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 400),
            (overlay_set_position, "$g_multiplayer_message_1", pos1),
            (position_set_x, pos1, 2000),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_multiplayer_message_1", pos1),
            (presentation_set_duration, 400),
        (else_try),
            (eq, "$g_multiplayer_message_type", 8),
            (store_div, ":var_0", "$g_multiplayer_message_value_1", 100),
            (store_mod, reg0, "$g_multiplayer_message_value_1", 100),
            (val_sub, ":var_0", 1),
            (multiplayer_get_my_player, ":var_4"),
            (try_begin),
                (ge, ":var_4", 0),
                (player_get_agent_id, ":var_5", ":var_4"),
                (try_begin),
                    (ge, ":var_5", 0),
                    (play_sound, "snd_flag_returned"),
                (try_end),
            (try_end),
            (try_begin),
                (eq, ":var_0", 0),
                (assign, ":var_1", 4281589009),
            (else_try),
                (assign, ":var_1", 4294919202),
            (try_end),
            (multiplayer_get_my_player, ":var_4"),
            (try_begin),
                (ge, ":var_4", 0),
                (player_get_agent_id, ":var_5", ":var_4"),
                (try_begin),
                    (ge, ":var_5", 0),
                    (agent_get_team, ":var_6", ":var_5"),
                    (try_begin),
                        (eq, ":var_6", ":var_0"),
                        (assign, ":var_1", 4281589009),
                    (else_try),
                        (assign, ":var_1", 4294919202),
                    (try_end),
                (try_end),
            (try_end),
            (team_get_faction, ":var_3", ":var_0"),
            (str_store_faction_name, s1, ":var_3"),
            (str_store_string, s0, "str_s1_neutralized_flag_reg0"),
            (create_text_overlay, "$g_multiplayer_message_1", 0, 65552),
            (overlay_set_color, "$g_multiplayer_message_1", ":var_1"),
            (position_set_x, pos1, 345),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 400),
            (overlay_set_position, "$g_multiplayer_message_1", pos1),
            (position_set_x, pos1, 2000),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_multiplayer_message_1", pos1),
            (presentation_set_duration, 400),
        (else_try),
            (eq, "$g_multiplayer_message_type", 13),
            (assign, ":var_0", "$g_multiplayer_message_value_1"),
            (try_begin),
                (eq, ":var_0", 0),
                (assign, ":var_1", 4281589009),
            (else_try),
                (assign, ":var_1", 4294919202),
            (try_end),
            (multiplayer_get_my_player, ":var_4"),
            (try_begin),
                (ge, ":var_4", 0),
                (player_get_agent_id, ":var_5", ":var_4"),
                (try_begin),
                    (ge, ":var_5", 0),
                    (agent_get_team, ":var_6", ":var_5"),
                    (try_begin),
                        (eq, ":var_6", ":var_0"),
                        (assign, ":var_1", 4281589009),
                    (else_try),
                        (assign, ":var_1", 4294919202),
                    (try_end),
                (try_end),
            (try_end),
            (try_begin),
                (eq, "$g_multiplayer_message_value_1", 0),
                (str_store_string, s0, "str_s1_defended_castle"),
            (else_try),
                (eq, "$g_multiplayer_message_value_1", 1),
                (str_store_string, s0, "str_s1_captured_castle"),
            (else_try),
                (str_store_string, s0, "str_round_draw"),
                (assign, ":var_1", 4294967295),
            (try_end),
            (create_text_overlay, "$g_multiplayer_message_1", 0, 65552),
            (overlay_set_color, "$g_multiplayer_message_1", ":var_1"),
            (try_begin),
                (neg|eq, "$g_multiplayer_message_value_1", -1),
                (position_set_x, pos1, 325),
            (else_try),
                (position_set_x, pos1, 400),
            (try_end),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 400),
            (overlay_set_position, "$g_multiplayer_message_1", pos1),
            (position_set_x, pos1, 2000),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_multiplayer_message_1", pos1),
            (presentation_set_duration, 400),
        (else_try),
            (eq, "$g_multiplayer_message_type", 14),
            (assign, ":var_1", 4294967295),
            (str_store_string, s0, "str_round_draw"),
            (create_text_overlay, "$g_multiplayer_message_1", 0, 65552),
            (overlay_set_color, "$g_multiplayer_message_1", ":var_1"),
            (position_set_x, pos1, 375),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 400),
            (overlay_set_position, "$g_multiplayer_message_1", pos1),
            (position_set_x, pos1, 2000),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_multiplayer_message_1", pos1),
            (presentation_set_duration, 400),
        (else_try),
            (eq, "$g_multiplayer_message_type", 18),
            (assign, ":var_1", 4294967295),
            (str_store_string, s0, "str_death_mode_started"),
            (create_text_overlay, "$g_multiplayer_message_1", 0, 65552),
            (overlay_set_color, "$g_multiplayer_message_1", ":var_1"),
            (position_set_x, pos1, 350),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 400),
            (overlay_set_position, "$g_multiplayer_message_1", pos1),
            (position_set_x, pos1, 2000),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_multiplayer_message_1", pos1),
            (presentation_set_duration, 400),
        (else_try),
            (eq, "$g_multiplayer_message_type", 15),
            (try_begin),
                (neg|ge, "$g_multiplayer_message_value_1", 0),
                (val_mul, "$g_multiplayer_message_value_1", -1),
                (assign, ":var_11", 0),
                (team_get_faction, ":var_2", 1),
                (str_store_faction_name, s1, ":var_2"),
            (else_try),
                (assign, ":var_11", 1),
                (team_get_faction, ":var_2", 0),
                (str_store_faction_name, s1, ":var_2"),
            (try_end),
            (try_begin),
                (eq, "$g_multiplayer_message_value_1", 1),
                (assign, ":var_1", 4281589009),
            (else_try),
                (assign, ":var_1", 4294919202),
            (try_end),
            (multiplayer_get_my_player, ":var_4"),
            (try_begin),
                (ge, ":var_4", 0),
                (try_begin),
                    (multiplayer_get_my_player, ":var_4"),
                    (player_get_team_no, ":var_12", ":var_4"),
                    (neg|eq, ":var_11", ":var_12"),
                    (assign, ":var_1", 4281589009),
                (else_try),
                    (assign, ":var_1", 4294919202),
                (try_end),
            (try_end),
            (try_begin),
                (eq, "$g_multiplayer_message_value_1", 9),
                (str_store_string, s0, "str_s1_destroyed_all_targets"),
            (else_try),
                (eq, "$g_multiplayer_message_value_1", 1),
                (str_store_string, s0, "str_s1_destroyed_catapult"),
            (else_try),
                (eq, "$g_multiplayer_message_value_1", 2),
                (str_store_string, s0, "str_s1_destroyed_trebuchet"),
            (try_end),
            (create_text_overlay, "$g_multiplayer_message_1", 0, 65552),
            (overlay_set_color, "$g_multiplayer_message_1", ":var_1"),
            (position_set_x, pos1, 350),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 400),
            (overlay_set_position, "$g_multiplayer_message_1", pos1),
            (position_set_x, pos1, 2000),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_multiplayer_message_1", pos1),
            (presentation_set_duration, 400),
        (else_try),
            (eq, "$g_multiplayer_message_type", 16),
            (try_begin),
                (eq, "$g_defender_team", 0),
                (assign, ":var_1", 4281589009),
            (else_try),
                (assign, ":var_1", 4294919202),
            (try_end),
            (multiplayer_get_my_player, ":var_4"),
            (try_begin),
                (ge, ":var_4", 0),
                (player_get_agent_id, ":var_5", ":var_4"),
                (try_begin),
                    (ge, ":var_5", 0),
                    (agent_get_team, ":var_6", ":var_5"),
                    (try_begin),
                        (eq, ":var_6", "$g_defender_team"),
                        (assign, ":var_1", 4281589009),
                    (else_try),
                        (assign, ":var_1", 4294919202),
                    (try_end),
                (try_end),
            (try_end),
            (assign, ":var_13", "$g_multiplayer_message_value_1"),
            (team_get_faction, ":var_2", "$g_defender_team"),
            (str_store_faction_name, s1, ":var_2"),
            (try_begin),
                (eq, ":var_13", 1),
                (str_store_string, s0, "str_s1_saved_1_target"),
            (else_try),
                (eq, ":var_13", 2),
                (str_store_string, s0, "str_s1_saved_2_targets"),
            (try_end),
            (create_text_overlay, "$g_multiplayer_message_1", 0, 65552),
            (overlay_set_color, "$g_multiplayer_message_1", ":var_1"),
            (position_set_x, pos1, 350),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 400),
            (overlay_set_position, "$g_multiplayer_message_1", pos1),
            (position_set_x, pos1, 2000),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_multiplayer_message_1", pos1),
            (presentation_set_duration, 400),
        (else_try),
            (eq, "$g_multiplayer_message_type", 17),
            (assign, ":var_0", "$g_multiplayer_message_value_1"),
            (try_begin),
                (eq, ":var_0", 0),
                (assign, ":var_1", 4281589009),
            (else_try),
                (assign, ":var_1", 4294919202),
            (try_end),
            (multiplayer_get_my_player, ":var_4"),
            (try_begin),
                (ge, ":var_4", 0),
                (player_get_agent_id, ":var_5", ":var_4"),
                (try_begin),
                    (ge, ":var_5", 0),
                    (agent_get_team, ":var_6", ":var_5"),
                    (try_begin),
                        (eq, ":var_6", ":var_0"),
                        (assign, ":var_1", 4281589009),
                    (else_try),
                        (assign, ":var_1", 4294919202),
                    (try_end),
                (try_end),
            (try_end),
            (try_begin),
                (eq, "$g_defender_team", 0),
                (team_get_faction, ":var_2", 1),
            (else_try),
                (team_get_faction, ":var_2", 0),
            (try_end),
            (str_store_faction_name, s1, ":var_2"),
            (str_store_string, s0, "str_s1_won_round"),
            (create_text_overlay, "$g_multiplayer_message_1", 0, 65552),
            (overlay_set_color, "$g_multiplayer_message_1", ":var_1"),
            (position_set_x, pos1, 350),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 400),
            (overlay_set_position, "$g_multiplayer_message_1", pos1),
            (position_set_x, pos1, 2000),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_multiplayer_message_1", pos1),
            (presentation_set_duration, 400),
        (try_end),
    ]),
    (ti_on_presentation_run, [
    ]),
]),

("multiplayer_message_2", prsntf_manual_end_only|prsntf_read_only, 0, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (try_begin),
            (eq, "$g_multiplayer_message_type", 2),
            (assign, ":var_0", 4294967295),
            (str_store_string, s0, "str_auto_team_balance_done"),
            (create_text_overlay, "$g_multiplayer_message_2", 0, 65552),
            (overlay_set_color, "$g_multiplayer_message_2", ":var_0"),
            (position_set_x, pos1, 375),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 550),
            (overlay_set_position, "$g_multiplayer_message_2", pos1),
            (position_set_x, pos1, 2000),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_multiplayer_message_2", pos1),
            (presentation_set_duration, 300),
        (else_try),
            (eq, "$g_multiplayer_message_type", 3),
            (assign, ":var_0", 4294967295),
            (try_begin),
                (neg|eq, "$g_multiplayer_game_type", 2),
                (neg|eq, "$g_multiplayer_game_type", 3),
                (neg|eq, "$g_multiplayer_game_type", 6),
                (str_store_string, s0, "str_auto_team_balance_in_20_seconds"),
                (position_set_x, pos1, 375),
            (else_try),
                (str_store_string, s0, "str_auto_team_balance_next_round"),
                (position_set_x, pos1, 375),
            (try_end),
            (create_text_overlay, "$g_multiplayer_message_2", 0, 65552),
            (overlay_set_color, "$g_multiplayer_message_2", ":var_0"),
            (position_set_y, pos1, 550),
            (position_set_x, pos1, 500),
            (overlay_set_position, "$g_multiplayer_message_2", pos1),
            (position_set_x, pos1, 2000),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_multiplayer_message_2", pos1),
            (presentation_set_duration, 300),
        (try_end),
    ]),
    (ti_on_presentation_run, [
    ]),
]),

("multiplayer_message_3", prsntf_manual_end_only|prsntf_read_only, 0, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (try_begin),
            (eq, "$g_multiplayer_message_type", 7),
            (assign, ":var_0", 4294967295),
            (try_begin),
                (eq, "$g_multiplayer_message_value_3", 1),
                (str_store_string, s0, "str_poll_result_yes"),
            (else_try),
                (str_store_string, s0, "str_poll_result_no"),
            (try_end),
            (create_text_overlay, "$g_multiplayer_message_3", 0, 65552),
            (overlay_set_color, "$g_multiplayer_message_3", ":var_0"),
            (position_set_x, pos1, 380),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 475),
            (overlay_set_position, "$g_multiplayer_message_3", pos1),
            (position_set_x, pos1, 2000),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_multiplayer_message_3", pos1),
            (presentation_set_duration, 400),
        (try_end),
    ]),
    (ti_on_presentation_run, [
    ]),
]),

("multiplayer_round_time_counter", prsntf_manual_end_only|prsntf_read_only, 0, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (assign, "$g_multiplayer_last_round_time_counter_value", -1),
        (str_clear, s0),
        (create_text_overlay, "$g_multiplayer_round_time_counter_overlay", 0, 98308),
        (overlay_set_color, "$g_multiplayer_round_time_counter_overlay", 16777215),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 690),
        (overlay_set_position, "$g_multiplayer_round_time_counter_overlay", pos1),
        (position_set_x, pos1, 2000),
        (position_set_y, pos1, 2000),
        (overlay_set_size, "$g_multiplayer_round_time_counter_overlay", pos1),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_run, [
        (store_mission_timer_a, ":var_0"),
        (store_sub, ":var_1", ":var_0", "$g_round_start_time"),
        (store_sub, ":var_2", "$g_multiplayer_round_max_seconds", ":var_1"),
        (val_max, ":var_2", 0),
        (try_begin),
            (neg|eq, "$g_multiplayer_last_round_time_counter_value", ":var_2"),
            (assign, "$g_multiplayer_last_round_time_counter_value", ":var_2"),
            (store_div, reg0, ":var_2", 60),
            (store_div, reg1, ":var_2", 10),
            (val_mod, reg1, 6),
            (assign, reg2, ":var_2"),
            (val_mod, reg2, 10),
            (str_store_string, s0, "str_reg0_dd_reg1reg2"),
            (overlay_set_text, "$g_multiplayer_round_time_counter_overlay", 0),
        (try_end),
    ]),
]),

("multiplayer_team_score_display", prsntf_manual_end_only|prsntf_read_only, 0, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (assign, "$g_multiplayer_team_1_last_displayed_score", -1),
        (assign, "$g_multiplayer_team_2_last_displayed_score", -1),
        (str_clear, s0),
        (create_text_overlay, "$g_multiplayer_team_1_score_display_overlay", 0, 98308),
        (overlay_set_color, "$g_multiplayer_team_1_score_display_overlay", 16777215),
        (position_set_x, pos1, 40),
        (position_set_y, pos1, 700),
        (overlay_set_position, "$g_multiplayer_team_1_score_display_overlay", pos1),
        (position_set_x, pos1, 1500),
        (position_set_y, pos1, 1500),
        (overlay_set_size, "$g_multiplayer_team_1_score_display_overlay", pos1),
        (create_text_overlay, "$g_multiplayer_team_2_score_display_overlay", 0, 98308),
        (overlay_set_color, "$g_multiplayer_team_2_score_display_overlay", 16777215),
        (position_set_x, pos1, 40),
        (position_set_y, pos1, 645),
        (overlay_set_position, "$g_multiplayer_team_2_score_display_overlay", pos1),
        (position_set_x, pos1, 1500),
        (position_set_y, pos1, 1500),
        (overlay_set_size, "$g_multiplayer_team_2_score_display_overlay", pos1),
        (try_begin),
            (eq, "$g_multiplayer_team_1_faction", "fac_kingdom_4"),
            (create_mesh_overlay, reg0, "mesh_ui_kingdom_shield_1"),
        (else_try),
            (eq, "$g_multiplayer_team_1_faction", "fac_kingdom_2"),
            (create_mesh_overlay, reg0, "mesh_ui_kingdom_shield_2"),
        (else_try),
            (eq, "$g_multiplayer_team_1_faction", "fac_kingdom_3"),
            (create_mesh_overlay, reg0, "mesh_ui_kingdom_shield_3"),
        (else_try),
            (eq, "$g_multiplayer_team_1_faction", "fac_kingdom_5"),
            (create_mesh_overlay, reg0, "mesh_ui_kingdom_shield_4"),
        (else_try),
            (eq, "$g_multiplayer_team_1_faction", "fac_kingdom_1"),
            (create_mesh_overlay, reg0, "mesh_ui_kingdom_shield_6"),
        (try_end),
        (position_set_x, pos3, 25),
        (position_set_y, pos3, 715),
        (overlay_set_position, reg0, pos3),
        (position_set_x, pos1, 50),
        (position_set_y, pos1, 50),
        (overlay_set_size, reg0, pos1),
        (try_begin),
            (eq, "$g_multiplayer_team_1_faction", "$g_multiplayer_team_2_faction"),
            (create_mesh_overlay, reg0, "mesh_ui_kingdom_shield_7"),
        (else_try),
            (eq, "$g_multiplayer_team_2_faction", "fac_kingdom_4"),
            (create_mesh_overlay, reg0, "mesh_ui_kingdom_shield_1"),
        (else_try),
            (eq, "$g_multiplayer_team_2_faction", "fac_kingdom_2"),
            (create_mesh_overlay, reg0, "mesh_ui_kingdom_shield_2"),
        (else_try),
            (eq, "$g_multiplayer_team_2_faction", "fac_kingdom_3"),
            (create_mesh_overlay, reg0, "mesh_ui_kingdom_shield_3"),
        (else_try),
            (eq, "$g_multiplayer_team_2_faction", "fac_kingdom_5"),
            (create_mesh_overlay, reg0, "mesh_ui_kingdom_shield_4"),
        (else_try),
            (eq, "$g_multiplayer_team_2_faction", "fac_kingdom_1"),
            (create_mesh_overlay, reg0, "mesh_ui_kingdom_shield_6"),
        (try_end),
        (position_set_x, pos3, 25),
        (position_set_y, pos3, 660),
        (overlay_set_position, reg0, pos3),
        (position_set_x, pos1, 50),
        (position_set_y, pos1, 50),
        (overlay_set_size, reg0, pos1),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_run, [
        (team_get_score, ":var_0", 0),
        (team_get_score, ":var_1", 1),
        (try_begin),
            (this_or_next|neg|eq, ":var_0", "$g_multiplayer_team_1_last_displayed_score"),
            (neg|eq, ":var_1", "$g_multiplayer_team_2_last_displayed_score"),
            (assign, "$g_multiplayer_team_1_last_displayed_score", ":var_0"),
            (assign, "$g_multiplayer_team_2_last_displayed_score", ":var_1"),
            (str_store_faction_name, s0, "$g_multiplayer_team_1_faction"),
            (assign, reg0, ":var_0"),
            (overlay_set_text, "$g_multiplayer_team_1_score_display_overlay", "str_reg0"),
            (str_store_faction_name, s0, "$g_multiplayer_team_2_faction"),
            (assign, reg0, ":var_1"),
            (overlay_set_text, "$g_multiplayer_team_2_score_display_overlay", "str_reg0"),
        (try_end),
    ]),
]),

("multiplayer_flag_projection_display", prsntf_manual_end_only|prsntf_read_only, 0, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (store_sub, ":var_0", "$g_multiplayer_team_1_faction", "fac_kingdom_1"),
        (val_add, ":var_0", "mesh_flag_project_sw"),
        (create_mesh_overlay, "$g_presentation_obj_flag_projection_display_1", ":var_0"),
        (val_sub, ":var_0", "mesh_flag_project_sw"),
        (val_add, ":var_0", "mesh_flag_project_sw_miss"),
        (create_mesh_overlay, "$g_presentation_obj_flag_projection_display_2", ":var_0"),
        (try_begin),
            (neg|eq, "$g_multiplayer_team_1_faction", "$g_multiplayer_team_2_faction"),
            (store_sub, ":var_0", "$g_multiplayer_team_2_faction", "fac_kingdom_1"),
            (val_add, ":var_0", "mesh_flag_project_sw"),
            (create_mesh_overlay, "$g_presentation_obj_flag_projection_display_3", ":var_0"),
            (val_sub, ":var_0", "mesh_flag_project_sw"),
            (val_add, ":var_0", "mesh_flag_project_sw_miss"),
            (create_mesh_overlay, "$g_presentation_obj_flag_projection_display_4", ":var_0"),
        (else_try),
            (assign, ":var_0", "mesh_flag_project_rb"),
            (create_mesh_overlay, "$g_presentation_obj_flag_projection_display_3", ":var_0"),
            (assign, ":var_0", "mesh_flag_project_rb_miss"),
            (create_mesh_overlay, "$g_presentation_obj_flag_projection_display_4", ":var_0"),
        (try_end),
        (position_set_x, pos1, 250),
        (position_set_y, pos1, 250),
        (overlay_set_size, "$g_presentation_obj_flag_projection_display_1", pos1),
        (overlay_set_size, "$g_presentation_obj_flag_projection_display_2", pos1),
        (overlay_set_size, "$g_presentation_obj_flag_projection_display_3", pos1),
        (overlay_set_size, "$g_presentation_obj_flag_projection_display_4", pos1),
        (overlay_set_display, "$g_presentation_obj_flag_projection_display_1", 0),
        (overlay_set_display, "$g_presentation_obj_flag_projection_display_2", 0),
        (overlay_set_display, "$g_presentation_obj_flag_projection_display_3", 0),
        (overlay_set_display, "$g_presentation_obj_flag_projection_display_4", 0),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_run, [
        (set_fixed_point_multiplier, 1000),
        (scene_prop_get_instance, ":var_0", "$team_1_flag_scene_prop", 0),
        (team_get_slot, ":var_1", 0, 0),
        (try_begin),
            (neg|eq, ":var_1", 1),
            (prop_instance_get_position, pos1, ":var_0"),
        (else_try),
            (entry_point_get_position, pos1, 64),
        (try_end),
        (position_move_z, pos1, 200, 1),
        (scene_prop_get_instance, ":var_2", "$team_2_flag_scene_prop", 0),
        (team_get_slot, ":var_3", 1, 0),
        (try_begin),
            (neg|eq, ":var_3", 1),
            (prop_instance_get_position, pos2, ":var_2"),
        (else_try),
            (entry_point_get_position, pos2, 65),
        (try_end),
        (position_move_z, pos2, 200, 1),
        (position_get_screen_projection, pos3, pos1),
        (position_get_x, ":var_4", pos3),
        (position_get_y, ":var_5", pos3),
        (position_set_y, pos3, ":var_5"),
        (try_begin),
            (is_between, ":var_4", -100, 1100),
            (is_between, ":var_5", -100, 850),
            (multiplayer_get_my_player, ":var_6"),
            (try_begin),
                (ge, ":var_6", 0),
                (player_get_team_no, ":var_7", ":var_6"),
            (else_try),
                (assign, ":var_7", 2),
            (try_end),
            (try_begin),
                (neg|eq, ":var_7", 1),
                (try_begin),
                    (neg|eq, ":var_1", 1),
                    (overlay_set_position, "$g_presentation_obj_flag_projection_display_1", pos3),
                    (overlay_set_display, "$g_presentation_obj_flag_projection_display_1", 1),
                    (overlay_set_display, "$g_presentation_obj_flag_projection_display_2", 0),
                (else_try),
                    (try_begin),
                        (eq, ":var_7", 0),
                        (assign, ":var_8", 64),
                    (else_try),
                        (assign, ":var_8", 65),
                    (try_end),
                    (entry_point_get_position, pos5, ":var_8"),
                    (position_get_screen_projection, pos3, pos5),
                    (overlay_set_position, "$g_presentation_obj_flag_projection_display_2", pos3),
                    (overlay_set_display, "$g_presentation_obj_flag_projection_display_2", 1),
                    (overlay_set_display, "$g_presentation_obj_flag_projection_display_1", 0),
                (try_end),
            (else_try),
                (try_begin),
                    (neg|eq, ":var_1", 1),
                    (overlay_set_position, "$g_presentation_obj_flag_projection_display_1", pos3),
                    (overlay_set_display, "$g_presentation_obj_flag_projection_display_1", 1),
                    (overlay_set_display, "$g_presentation_obj_flag_projection_display_2", 0),
                (try_end),
            (try_end),
        (else_try),
            (overlay_set_display, "$g_presentation_obj_flag_projection_display_1", 0),
            (overlay_set_display, "$g_presentation_obj_flag_projection_display_2", 0),
        (try_end),
        (position_get_screen_projection, pos3, pos2),
        (position_get_x, ":var_4", pos3),
        (position_get_y, ":var_5", pos3),
        (position_set_y, pos3, ":var_5"),
        (try_begin),
            (is_between, ":var_4", -100, 1100),
            (is_between, ":var_5", -100, 850),
            (team_get_slot, ":var_3", 1, 0),
            (multiplayer_get_my_player, ":var_6"),
            (try_begin),
                (ge, ":var_6", 0),
                (player_get_team_no, ":var_7", ":var_6"),
            (else_try),
                (assign, ":var_7", 2),
            (try_end),
            (try_begin),
                (neg|eq, ":var_7", 0),
                (try_begin),
                    (neg|eq, ":var_3", 1),
                    (overlay_set_position, "$g_presentation_obj_flag_projection_display_3", pos3),
                    (overlay_set_display, "$g_presentation_obj_flag_projection_display_3", 1),
                    (overlay_set_display, "$g_presentation_obj_flag_projection_display_4", 0),
                (else_try),
                    (try_begin),
                        (eq, ":var_7", 0),
                        (assign, ":var_8", 64),
                    (else_try),
                        (assign, ":var_8", 65),
                    (try_end),
                    (entry_point_get_position, pos5, ":var_8"),
                    (position_get_screen_projection, pos3, pos5),
                    (overlay_set_position, "$g_presentation_obj_flag_projection_display_4", pos3),
                    (overlay_set_display, "$g_presentation_obj_flag_projection_display_4", 1),
                    (overlay_set_display, "$g_presentation_obj_flag_projection_display_3", 0),
                (try_end),
            (else_try),
                (try_begin),
                    (neg|eq, ":var_3", 1),
                    (overlay_set_position, "$g_presentation_obj_flag_projection_display_3", pos3),
                    (overlay_set_display, "$g_presentation_obj_flag_projection_display_3", 1),
                    (overlay_set_display, "$g_presentation_obj_flag_projection_display_4", 0),
                (try_end),
            (try_end),
        (else_try),
            (overlay_set_display, "$g_presentation_obj_flag_projection_display_3", 0),
            (overlay_set_display, "$g_presentation_obj_flag_projection_display_4", 0),
        (try_end),
    ]),
]),

("multiplayer_flag_projection_display_bt", prsntf_manual_end_only|prsntf_read_only, 0, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (store_sub, ":var_0", "$g_multiplayer_team_1_faction", "fac_kingdom_1"),
        (val_add, ":var_0", "mesh_flag_project_sw"),
        (create_mesh_overlay, "$g_presentation_obj_flag_projection_display_1", ":var_0"),
        (try_begin),
            (neg|eq, "$g_multiplayer_team_1_faction", "$g_multiplayer_team_2_faction"),
            (store_sub, ":var_0", "$g_multiplayer_team_2_faction", "fac_kingdom_1"),
            (val_add, ":var_0", "mesh_flag_project_sw"),
        (else_try),
            (assign, ":var_0", "mesh_flag_project_rb"),
        (try_end),
        (create_mesh_overlay, "$g_presentation_obj_flag_projection_display_3", ":var_0"),
        (position_set_x, pos1, 250),
        (position_set_y, pos1, 250),
        (overlay_set_size, "$g_presentation_obj_flag_projection_display_1", pos1),
        (overlay_set_size, "$g_presentation_obj_flag_projection_display_3", pos1),
        (overlay_set_display, "$g_presentation_obj_flag_projection_display_1", 0),
        (overlay_set_display, "$g_presentation_obj_flag_projection_display_3", 0),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_run, [
        (try_begin),
            (eq, "$g_round_ended", 0),
            (set_fixed_point_multiplier, 1000),
            (scene_prop_get_instance, ":var_0", "$team_1_flag_scene_prop", 0),
            (prop_instance_get_position, pos1, ":var_0"),
            (position_move_z, pos1, 250, 1),
            (scene_prop_get_instance, ":var_1", "$team_2_flag_scene_prop", 0),
            (prop_instance_get_position, pos2, ":var_1"),
            (position_move_z, pos2, 250, 1),
            (position_get_screen_projection, pos3, pos1),
            (position_get_x, ":var_2", pos3),
            (position_get_y, ":var_3", pos3),
            (position_set_y, pos3, ":var_3"),
            (try_begin),
                (is_between, ":var_2", -100, 1100),
                (is_between, ":var_3", -100, 850),
                (overlay_set_position, "$g_presentation_obj_flag_projection_display_1", pos3),
                (overlay_set_display, "$g_presentation_obj_flag_projection_display_1", 1),
            (else_try),
                (overlay_set_display, "$g_presentation_obj_flag_projection_display_1", 0),
            (try_end),
            (position_get_screen_projection, pos3, pos2),
            (position_get_x, ":var_2", pos3),
            (position_get_y, ":var_3", pos3),
            (position_set_y, pos3, ":var_3"),
            (try_begin),
                (is_between, ":var_2", -100, 1100),
                (is_between, ":var_3", -100, 850),
                (overlay_set_position, "$g_presentation_obj_flag_projection_display_3", pos3),
                (overlay_set_display, "$g_presentation_obj_flag_projection_display_3", 1),
            (else_try),
                (overlay_set_display, "$g_presentation_obj_flag_projection_display_3", 0),
            (try_end),
        (else_try),
            (presentation_set_duration, 0),
        (try_end),
    ]),
]),

("multiplayer_destructible_targets_display", prsntf_manual_end_only|prsntf_read_only, 0, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (try_begin),
            (eq, "$g_defender_team", 0),
            (store_sub, ":var_0", "$g_multiplayer_team_1_faction", "fac_kingdom_1"),
        (else_try),
            (store_sub, ":var_0", "$g_multiplayer_team_2_faction", "fac_kingdom_1"),
        (try_end),
        (val_add, ":var_0", "mesh_flag_project_sw"),
        (create_mesh_overlay, "$g_presentation_obj_flag_projection_display_1", ":var_0"),
        (create_mesh_overlay, "$g_presentation_obj_flag_projection_display_2", ":var_0"),
        (position_set_x, pos1, 250),
        (position_set_y, pos1, 250),
        (overlay_set_size, "$g_presentation_obj_flag_projection_display_1", pos1),
        (overlay_set_size, "$g_presentation_obj_flag_projection_display_2", pos1),
        (overlay_set_display, "$g_presentation_obj_flag_projection_display_1", 0),
        (overlay_set_display, "$g_presentation_obj_flag_projection_display_2", 0),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_run, [
        (try_begin),
            (eq, "$g_round_ended", 0),
            (set_fixed_point_multiplier, 1000),
            (scene_prop_get_instance, ":var_0", "$g_destructible_target_1", 0),
            (prop_instance_get_position, pos1, ":var_0"),
            (prop_instance_get_position, pos1, ":var_0"),
            (position_move_z, pos1, 250, 1),
            (scene_prop_get_instance, ":var_1", "$g_destructible_target_2", 0),
            (prop_instance_get_position, pos2, ":var_1"),
            (prop_instance_get_position, pos2, ":var_1"),
            (position_move_z, pos2, 250, 1),
            (position_get_screen_projection, pos3, pos1),
            (position_get_x, ":var_2", pos3),
            (position_get_y, ":var_3", pos3),
            (position_set_y, pos3, ":var_3"),
            (try_begin),
                (is_between, ":var_2", -100, 1100),
                (is_between, ":var_3", -100, 850),
                (prop_instance_get_starting_position, pos0, ":var_0"),
                (prop_instance_get_position, pos1, ":var_0"),
                (get_sq_distance_between_positions_in_meters, ":var_4", pos0, pos1),
                (neg|gt, ":var_4", 2),
                (overlay_set_position, "$g_presentation_obj_flag_projection_display_1", pos3),
                (overlay_set_display, "$g_presentation_obj_flag_projection_display_1", 1),
            (else_try),
                (overlay_set_display, "$g_presentation_obj_flag_projection_display_1", 0),
            (try_end),
            (position_get_screen_projection, pos3, pos2),
            (position_get_x, ":var_2", pos3),
            (position_get_y, ":var_3", pos3),
            (position_set_y, pos3, ":var_3"),
            (try_begin),
                (is_between, ":var_2", -100, 1100),
                (is_between, ":var_3", -100, 850),
                (prop_instance_get_starting_position, pos0, ":var_1"),
                (prop_instance_get_position, pos1, ":var_1"),
                (get_sq_distance_between_positions_in_meters, ":var_4", pos0, pos1),
                (neg|gt, ":var_4", 2),
                (overlay_set_position, "$g_presentation_obj_flag_projection_display_2", pos3),
                (overlay_set_display, "$g_presentation_obj_flag_projection_display_2", 1),
            (else_try),
                (overlay_set_display, "$g_presentation_obj_flag_projection_display_2", 0),
            (try_end),
        (else_try),
            (presentation_set_duration, 0),
        (try_end),
    ]),
]),

("multiplayer_respawn_time_counter", prsntf_manual_end_only|prsntf_read_only, 0, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (assign, "$g_multiplayer_respawn_counter_overlay", -1),
        (assign, "$g_multiplayer_respawn_remained_overlay", -1),
        (assign, ":var_0", 0),
        (try_begin),
            (eq, "$g_multiplayer_message_type", 13),
            (this_or_next|eq, "$g_round_ended", 1),
            (eq, "$g_flag_is_not_ready", 1),
            (assign, ":var_0", 1),
        (try_end),
        (eq, ":var_0", 0),
        (assign, "$g_multiplayer_last_respawn_counter_value", -1),
        (str_clear, s0),
        (create_text_overlay, "$g_multiplayer_respawn_counter_overlay", 0, 65552),
        (overlay_set_color, "$g_multiplayer_respawn_counter_overlay", 16777215),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 600),
        (overlay_set_position, "$g_multiplayer_respawn_counter_overlay", pos1),
        (position_set_x, pos1, 2000),
        (position_set_y, pos1, 2000),
        (overlay_set_size, "$g_multiplayer_respawn_counter_overlay", pos1),
        (str_clear, s0),
        (create_text_overlay, "$g_multiplayer_respawn_remained_overlay", 0, 65552),
        (overlay_set_color, "$g_multiplayer_respawn_remained_overlay", 16777215),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 570),
        (overlay_set_position, "$g_multiplayer_respawn_remained_overlay", pos1),
        (position_set_x, pos1, 1400),
        (position_set_y, pos1, 1400),
        (overlay_set_size, "$g_multiplayer_respawn_remained_overlay", pos1),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_run, [
        (ge, "$g_multiplayer_respawn_counter_overlay", 0),
        (multiplayer_get_my_player, ":var_0"),
        (try_begin),
            (ge, ":var_0", 0),
            (player_get_team_no, ":var_1", ":var_0"),
            (try_begin),
                (eq, ":var_1", 2),
                (presentation_set_duration, 0),
            (else_try),
                (store_mission_timer_a, ":var_2"),
                (store_sub, ":var_3", ":var_2", "$g_multiplayer_respawn_start_time"),
                (try_begin),
                    (eq, "$g_show_no_more_respawns_remained", 0),
                    (assign, ":var_4", "$g_multiplayer_respawn_period"),
                    (try_begin),
                        (eq, "$g_multiplayer_game_type", 6),
                        (player_get_team_no, ":var_1", ":var_0"),
                        (eq, ":var_1", 0),
                        (val_add, ":var_4", 27),
                    (try_end),
                (else_try),
                    (assign, ":var_4", 6),
                (try_end),
                (store_sub, ":var_5", ":var_4", ":var_3"),
                (try_begin),
                    (neg|gt, ":var_5", 0),
                    (presentation_set_duration, 0),
                (else_try),
                    (neg|eq, "$g_multiplayer_last_respawn_counter_value", ":var_5"),
                    (assign, "$g_multiplayer_last_respawn_counter_value", ":var_5"),
                    (try_begin),
                        (eq, "$g_show_no_more_respawns_remained", 0),
                        (assign, reg0, ":var_5"),
                        (str_store_string, s0, "str_respawning_in_reg0_seconds"),
                        (try_begin),
                            (gt, "$g_multiplayer_number_of_respawn_count", 0),
                            (store_sub, reg0, "$g_multiplayer_number_of_respawn_count", "$g_my_spawn_count"),
                            (multiplayer_get_my_player, ":var_0"),
                            (player_get_team_no, ":var_6", ":var_0"),
                            (eq, ":var_6", 0),
                            (try_begin),
                                (gt, reg0, 1),
                                (str_store_string, s1, "str_reg0_respawns_remained"),
                            (else_try),
                                (str_store_string, s1, "str_this_is_your_last_respawn"),
                            (try_end),
                        (else_try),
                            (str_clear, s1),
                        (try_end),
                    (else_try),
                        (eq, "$g_show_no_more_respawns_remained", 1),
                        (str_store_string, s0, "str_no_more_respawns_remained_this_round"),
                        (str_clear, s1),
                        (str_store_string, s1, "str_wait_next_round"),
                    (try_end),
                    (overlay_set_text, "$g_multiplayer_respawn_counter_overlay", 0),
                    (overlay_set_text, "$g_multiplayer_respawn_remained_overlay", 1),
                (try_end),
            (try_end),
        (else_try),
            (presentation_set_duration, 0),
        (try_end),
        (try_begin),
            (eq, "$g_multiplayer_message_type", 13),
            (this_or_next|eq, "$g_round_ended", 1),
            (eq, "$g_flag_is_not_ready", 1),
            (presentation_set_duration, 0),
        (try_end),
    ]),
]),

("multiplayer_stats_chart", prsntf_manual_end_only|prsntf_read_only, 0, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (create_mesh_overlay, reg0, "mesh_mp_score_b"),
        (position_set_x, pos1, 100),
        (position_set_y, pos1, 100),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1000),
        (position_set_y, pos1, 1000),
        (overlay_set_size, reg0, pos1),
        (assign, ":var_0", 0),
        (assign, ":var_1", 0),
        (assign, ":var_2", 0),
        (get_max_players, ":var_3"),
        (try_for_range, ":var_4", 0, ":var_3"),
            (store_add, ":var_5", ":var_4", 186),
            (try_begin),
                (player_is_active, ":var_4"),
                (troop_set_slot, "trp_multiplayer_data", ":var_5", 1),
                (player_get_team_no, ":var_6", ":var_4"),
                (try_begin),
                    (eq, ":var_6", 0),
                    (val_add, ":var_0", 1),
                (else_try),
                    (eq, ":var_6", 1),
                    (val_add, ":var_1", 1),
                (else_try),
                    (eq, ":var_6", 2),
                    (val_add, ":var_2", 1),
                (try_end),
            (else_try),
                (troop_set_slot, "trp_multiplayer_data", ":var_5", 0),
            (try_end),
        (try_end),
        (try_begin),
            (gt, "$g_multiplayer_num_bots_team_1", 0),
            (val_add, ":var_0", 1),
        (try_end),
        (try_begin),
            (gt, "$g_multiplayer_num_bots_team_2", 0),
            (val_add, ":var_1", 1),
        (try_end),
        (assign, ":var_7", ":var_0"),
        (val_max, ":var_7", ":var_1"),
        (val_add, ":var_7", ":var_2"),
        (str_clear, s0),
        (create_text_overlay, "$g_presentation_obj_stats_chart_container", 0, 131072),
        (position_set_x, pos1, 100),
        (position_set_y, pos1, 120),
        (overlay_set_position, "$g_presentation_obj_stats_chart_container", pos1),
        (position_set_x, pos1, 746),
        (position_set_y, pos1, 530),
        (overlay_set_area_size, "$g_presentation_obj_stats_chart_container", pos1),
        (set_container_overlay, "$g_presentation_obj_stats_chart_container"),
        (store_mul, ":var_8", ":var_7", 20),
        (val_add, ":var_8", 100),
        (try_begin),
            (gt, ":var_2", 0),
            (val_add, ":var_8", 70),
        (try_end),
        (multiplayer_get_my_player, ":var_9"),
        (try_begin),
            (gt, ":var_8", 490),
            (assign, "$g_stats_chart_update_period", 8),
        (else_try),
            (assign, "$g_stats_chart_update_period", 1),
        (try_end),
        (try_begin),
            (eq, "$g_multiplayer_game_type", 5),
            (call_script, "script_get_headquarters_scores"),
            (assign, ":var_10", reg0),
            (assign, ":var_11", reg1),
        (try_end),
        (try_for_range, ":var_12", 0, 2),
            (assign, ":var_13", 0),
            (get_max_players, ":var_3"),
            (try_for_range, ":var_4", 0, ":var_3"),
                (player_is_active, ":var_4"),
                (player_get_team_no, ":var_14", ":var_4"),
                (eq, ":var_14", ":var_12"),
                (val_add, ":var_13", 1),
            (try_end),
            (assign, reg0, ":var_13"),
            (try_begin),
                (neg|eq, ":var_13", 1),
                (create_text_overlay, reg1, "str_reg0_players", 0),
            (else_try),
                (create_text_overlay, reg1, "str_reg0_player", 0),
            (try_end),
            (assign, ":var_15", ":var_8"),
            (team_get_faction, ":var_16", ":var_12"),
            (str_store_faction_name, s1, ":var_16"),
            (create_text_overlay, reg0, 1, 0),
            (try_begin),
                (eq, ":var_12", 0),
                (overlay_set_color, reg0, 16711680),
                (overlay_set_color, reg1, 16711680),
            (else_try),
                (overlay_set_color, reg0, 39423),
                (overlay_set_color, reg1, 39423),
            (try_end),
            (assign, ":var_17", 373),
            (store_mul, ":var_18", ":var_17", ":var_12"),
            (val_add, ":var_18", 42),
            (store_add, ":var_19", ":var_18", 15),
            (position_set_x, pos3, ":var_19"),
            (position_set_y, pos3, ":var_15"),
            (store_add, ":var_20", ":var_18", 35),
            (position_set_x, pos1, ":var_20"),
            (position_set_y, pos1, ":var_15"),
            (copy_position, pos2, pos1),
            (store_sub, ":var_21", ":var_15", 10),
            (position_set_x, pos2, ":var_20"),
            (position_set_y, pos2, ":var_21"),
            (overlay_set_position, reg0, pos1),
            (overlay_set_position, reg1, pos2),
            (position_set_x, pos1, 1000),
            (position_set_y, pos1, 1000),
            (position_set_x, pos2, 600),
            (position_set_y, pos2, 600),
            (overlay_set_size, reg0, pos1),
            (overlay_set_size, reg1, pos2),
            (team_get_faction, ":var_22", 0),
            (team_get_faction, ":var_23", 1),
            (try_begin),
                (eq, ":var_22", ":var_23"),
                (eq, ":var_12", 1),
                (create_mesh_overlay, reg0, "mesh_ui_kingdom_shield_7"),
            (else_try),
                (eq, ":var_16", "fac_kingdom_4"),
                (create_mesh_overlay, reg0, "mesh_ui_kingdom_shield_1"),
            (else_try),
                (eq, ":var_16", "fac_kingdom_2"),
                (create_mesh_overlay, reg0, "mesh_ui_kingdom_shield_2"),
            (else_try),
                (eq, ":var_16", "fac_kingdom_3"),
                (create_mesh_overlay, reg0, "mesh_ui_kingdom_shield_3"),
            (else_try),
                (eq, ":var_16", "fac_kingdom_5"),
                (create_mesh_overlay, reg0, "mesh_ui_kingdom_shield_4"),
            (else_try),
                (eq, ":var_16", "fac_kingdom_1"),
                (create_mesh_overlay, reg0, "mesh_ui_kingdom_shield_6"),
            (try_end),
            (position_set_x, pos1, 100),
            (position_set_y, pos1, 100),
            (overlay_set_position, reg0, pos3),
            (position_set_x, pos1, 50),
            (position_set_y, pos1, 50),
            (overlay_set_size, reg0, pos1),
            (team_get_score, reg0, ":var_12"),
            (create_text_overlay, reg0, "str_score_reg0", 8),
            (overlay_set_color, reg0, 16777215),
            (store_add, ":var_24", ":var_18", 325),
            (store_add, ":var_25", ":var_15", 0),
            (position_set_x, pos1, ":var_24"),
            (position_set_y, pos1, ":var_25"),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 1200),
            (position_set_y, pos1, 1200),
            (overlay_set_size, reg0, pos1),
            (try_begin),
                (eq, "$g_multiplayer_game_type", 5),
                (try_begin),
                    (eq, ":var_12", 0),
                    (assign, reg0, ":var_10"),
                (else_try),
                    (eq, ":var_12", 1),
                    (assign, reg0, ":var_11"),
                (try_end),
                (create_text_overlay, reg0, "str_flags_reg0", 0),
                (overlay_set_color, reg0, 16777215),
                (store_add, ":var_24", ":var_18", 258),
                (store_add, ":var_25", ":var_15", -10),
                (position_set_x, pos1, ":var_24"),
                (position_set_y, pos1, ":var_25"),
                (overlay_set_position, reg0, pos1),
                (position_set_x, pos1, 600),
                (position_set_y, pos1, 600),
                (overlay_set_size, reg0, pos1),
            (try_end),
            (val_sub, ":var_15", 60),
            (create_text_overlay, reg0, "str_player_name", 0),
            (overlay_set_color, reg0, 16777215),
            (position_set_x, pos1, ":var_18"),
            (position_set_y, pos1, ":var_15"),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 750),
            (position_set_y, pos1, 750),
            (overlay_set_size, reg0, pos1),
            (try_begin),
                (this_or_next|eq, "$g_multiplayer_game_type", 4),
                (eq, "$g_multiplayer_game_type", 5),
                (create_text_overlay, reg0, "str_score", 0),
                (overlay_set_color, reg0, 16777215),
                (store_add, ":var_24", ":var_18", 138),
                (position_set_x, pos1, ":var_24"),
                (position_set_y, pos1, ":var_15"),
                (overlay_set_position, reg0, pos1),
                (position_set_x, pos1, 750),
                (position_set_y, pos1, 750),
                (overlay_set_size, reg0, pos1),
            (try_end),
            (create_text_overlay, reg0, "str_kills", 16),
            (overlay_set_color, reg0, 16777215),
            (store_add, ":var_24", ":var_18", 206),
            (position_set_x, pos1, ":var_24"),
            (position_set_y, pos1, ":var_15"),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 750),
            (position_set_y, pos1, 750),
            (overlay_set_size, reg0, pos1),
            (create_text_overlay, reg0, "str_deaths", 16),
            (overlay_set_color, reg0, 16777215),
            (store_add, ":var_24", ":var_18", 260),
            (position_set_x, pos1, ":var_24"),
            (position_set_y, pos1, ":var_15"),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 750),
            (position_set_y, pos1, 750),
            (overlay_set_size, reg0, pos1),
            (create_text_overlay, reg0, "str_ping", 16),
            (overlay_set_color, reg0, 16777215),
            (store_add, ":var_24", ":var_18", 308),
            (position_set_x, pos1, ":var_24"),
            (position_set_y, pos1, ":var_15"),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 750),
            (position_set_y, pos1, 750),
            (overlay_set_size, reg0, pos1),
            (create_mesh_overlay, reg0, "mesh_white_plane"),
            (overlay_set_color, reg0, 16777215),
            (overlay_set_alpha, reg0, 208),
            (store_add, ":var_24", ":var_18", 0),
            (position_set_x, pos1, ":var_24"),
            (store_add, ":var_25", ":var_15", -10),
            (position_set_y, pos1, ":var_25"),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 16500),
            (position_set_y, pos1, 50),
            (overlay_set_size, reg0, pos1),
            (val_sub, ":var_15", 35),
            (store_add, ":var_26", ":var_3", 1),
            (try_for_range, ":var_27", 0, ":var_26"),
                (assign, ":var_28", -30030),
                (assign, ":var_29", -1),
                (try_for_range, ":var_4", 0, ":var_3"),
                    (store_add, ":var_5", ":var_4", 186),
                    (troop_slot_eq, "trp_multiplayer_data", ":var_5", 1),
                    (player_get_team_no, ":var_6", ":var_4"),
                    (eq, ":var_6", ":var_12"),
                    (try_begin),
                        (this_or_next|eq, "$g_multiplayer_game_type", 4),
                        (eq, "$g_multiplayer_game_type", 5),
                        (player_get_score, ":var_30", ":var_4"),
                    (else_try),
                        (player_get_kill_count, ":var_30", ":var_4"),
                    (try_end),
                    (player_get_death_count, ":var_31", ":var_4"),
                    (store_mul, ":var_32", ":var_30", 1000),
                    (val_sub, ":var_32", ":var_31"),
                    (this_or_next|gt, ":var_32", ":var_28"),
                    (eq, ":var_32", -30030),
                    (assign, ":var_28", ":var_32"),
                    (assign, ":var_29", ":var_4"),
                (try_end),
                (try_begin),
                    (ge, ":var_29", 0),
                    (store_add, ":var_5", ":var_29", 186),
                    (troop_set_slot, "trp_multiplayer_data", ":var_5", 0),
                    (try_begin),
                        (eq, ":var_9", ":var_29"),
                        (create_mesh_overlay, reg0, "mesh_white_plane"),
                        (overlay_set_color, reg0, 16777215),
                        (overlay_set_alpha, reg0, 53),
                        (store_add, ":var_24", ":var_18", 0),
                        (position_set_x, pos1, ":var_24"),
                        (store_add, ":var_25", ":var_15", 0),
                        (position_set_y, pos1, ":var_25"),
                        (overlay_set_position, reg0, pos1),
                        (position_set_x, pos1, 16500),
                        (position_set_y, pos1, 1000),
                        (overlay_set_size, reg0, pos1),
                    (try_end),
                    (try_begin),
                        (this_or_next|eq, "$g_multiplayer_game_type", 4),
                        (eq, "$g_multiplayer_game_type", 5),
                        (assign, ":var_33", 16777215),
                        (player_get_agent_id, ":var_34", ":var_29"),
                        (try_begin),
                            (this_or_next|neg|ge, ":var_34", 0),
                            (neg|agent_is_alive, ":var_34"),
                            (assign, ":var_33", 16711680),
                        (try_end),
                        (player_get_score, reg0, ":var_29"),
                        (create_text_overlay, reg0, "str_reg0", 8),
                        (overlay_set_color, reg0, ":var_33"),
                        (position_set_x, pos1, 750),
                        (position_set_y, pos1, 750),
                        (overlay_set_size, reg0, pos1),
                        (store_add, ":var_24", ":var_18", 165),
                        (position_set_x, pos1, ":var_24"),
                        (position_set_y, pos1, ":var_15"),
                        (overlay_set_position, reg0, pos1),
                    (else_try),
                        (assign, ":var_33", 16777215),
                        (player_get_agent_id, ":var_34", ":var_29"),
                        (try_begin),
                            (this_or_next|neg|ge, ":var_34", 0),
                            (neg|agent_is_alive, ":var_34"),
                            (assign, ":var_33", 16711680),
                            (create_text_overlay, reg0, "str_dead", 0),
                            (overlay_set_color, reg0, ":var_33"),
                            (position_set_x, pos1, 750),
                            (position_set_y, pos1, 750),
                            (overlay_set_size, reg0, pos1),
                            (store_add, ":var_24", ":var_18", 130),
                            (position_set_x, pos1, ":var_24"),
                            (position_set_y, pos1, ":var_15"),
                            (overlay_set_position, reg0, pos1),
                        (try_end),
                    (try_end),
                    (str_store_player_username, s1, ":var_29"),
                    (create_text_overlay, reg0, 1, 0),
                    (overlay_set_color, reg0, ":var_33"),
                    (position_set_x, pos1, 750),
                    (position_set_y, pos1, 750),
                    (overlay_set_size, reg0, pos1),
                    (position_set_x, pos1, ":var_18"),
                    (position_set_y, pos1, ":var_15"),
                    (overlay_set_position, reg0, pos1),
                    (player_get_kill_count, reg0, ":var_29"),
                    (create_text_overlay, reg0, "str_reg0", 8),
                    (overlay_set_color, reg0, ":var_33"),
                    (position_set_x, pos1, 750),
                    (position_set_y, pos1, 750),
                    (overlay_set_size, reg0, pos1),
                    (store_add, ":var_24", ":var_18", 215),
                    (position_set_x, pos1, ":var_24"),
                    (position_set_y, pos1, ":var_15"),
                    (overlay_set_position, reg0, pos1),
                    (player_get_death_count, reg0, ":var_29"),
                    (create_text_overlay, reg0, "str_reg0", 8),
                    (overlay_set_color, reg0, ":var_33"),
                    (position_set_x, pos1, 750),
                    (position_set_y, pos1, 750),
                    (overlay_set_size, reg0, pos1),
                    (store_add, ":var_24", ":var_18", 265),
                    (position_set_x, pos1, ":var_24"),
                    (position_set_y, pos1, ":var_15"),
                    (overlay_set_position, reg0, pos1),
                    (player_get_ping, reg0, ":var_29"),
                    (create_text_overlay, reg0, "str_reg0", 8),
                    (overlay_set_color, reg0, ":var_33"),
                    (position_set_x, pos1, 750),
                    (position_set_y, pos1, 750),
                    (overlay_set_size, reg0, pos1),
                    (store_add, ":var_24", ":var_18", 315),
                    (position_set_x, pos1, ":var_24"),
                    (position_set_y, pos1, ":var_15"),
                    (overlay_set_position, reg0, pos1),
                    (val_sub, ":var_15", 20),
                (else_try),
                    (try_begin),
                        (try_begin),
                            (eq, ":var_12", 0),
                            (assign, ":var_35", "$g_multiplayer_num_bots_team_1"),
                        (else_try),
                            (assign, ":var_35", "$g_multiplayer_num_bots_team_2"),
                        (try_end),
                        (team_get_bot_kill_count, reg0, ":var_12"),
                        (team_get_bot_death_count, reg1, ":var_12"),
                        (try_begin),
                            (this_or_next|neg|eq, reg0, 0),
                            (this_or_next|neg|eq, reg1, 0),
                            (neg|eq, ":var_35", 0),
                            (assign, ":var_36", 1),
                        (else_try),
                            (assign, ":var_36", 0),
                        (try_end),
                        (eq, ":var_36", 1),
                        (assign, ":var_37", 0),
                        (try_for_agents, ":var_38"),
                            (agent_is_non_player, ":var_38"),
                            (agent_is_alive, ":var_38"),
                            (agent_get_team, ":var_39", ":var_38"),
                            (eq, ":var_39", ":var_12"),
                            (val_add, ":var_37", 1),
                        (try_end),
                        (store_sub, ":var_40", ":var_35", ":var_37"),
                        (try_begin),
                            (eq, ":var_37", 0),
                            (assign, ":var_33", 16711680),
                        (else_try),
                            (assign, ":var_33", 13684944),
                        (try_end),
                        (try_begin),
                            (gt, ":var_40", 0),
                            (try_begin),
                                (eq, ":var_35", 1),
                                (create_text_overlay, reg0, "str_dead", 0),
                                (store_add, ":var_24", ":var_18", 130),
                            (else_try),
                                (assign, reg0, ":var_40"),
                                (create_text_overlay, reg0, "str_reg0_dead", 0),
                                (store_add, ":var_24", ":var_18", 123),
                            (try_end),
                            (overlay_set_color, reg0, ":var_33"),
                            (position_set_x, pos1, 750),
                            (position_set_y, pos1, 750),
                            (overlay_set_size, reg0, pos1),
                            (position_set_x, pos1, ":var_24"),
                            (position_set_y, pos1, ":var_15"),
                            (overlay_set_position, reg0, pos1),
                        (try_end),
                        (try_begin),
                            (gt, ":var_35", 1),
                            (assign, reg0, ":var_35"),
                            (create_text_overlay, reg0, "str_bots_reg0_agents", 0),
                        (else_try),
                            (create_text_overlay, reg0, "str_bot_1_agent", 0),
                        (try_end),
                        (overlay_set_color, reg0, ":var_33"),
                        (position_set_x, pos1, 750),
                        (position_set_y, pos1, 750),
                        (overlay_set_size, reg0, pos1),
                        (position_set_x, pos1, ":var_18"),
                        (position_set_y, pos1, ":var_15"),
                        (overlay_set_position, reg0, pos1),
                        (team_get_bot_kill_count, reg0, ":var_12"),
                        (create_text_overlay, reg0, "str_reg0", 8),
                        (overlay_set_color, reg0, ":var_33"),
                        (position_set_x, pos1, 750),
                        (position_set_y, pos1, 750),
                        (overlay_set_size, reg0, pos1),
                        (store_add, ":var_24", ":var_18", 215),
                        (position_set_x, pos1, ":var_24"),
                        (position_set_y, pos1, ":var_15"),
                        (overlay_set_position, reg0, pos1),
                        (team_get_bot_death_count, reg0, ":var_12"),
                        (create_text_overlay, reg0, "str_reg0", 8),
                        (overlay_set_color, reg0, ":var_33"),
                        (position_set_x, pos1, 750),
                        (position_set_y, pos1, 750),
                        (overlay_set_size, reg0, pos1),
                        (store_add, ":var_24", ":var_18", 265),
                        (position_set_x, pos1, ":var_24"),
                        (position_set_y, pos1, ":var_15"),
                        (overlay_set_position, reg0, pos1),
                        (val_sub, ":var_15", 20),
                    (try_end),
                    (assign, ":var_26", 0),
                (try_end),
            (try_end),
            (try_begin),
                (eq, ":var_12", 0),
                (assign, ":var_41", ":var_15"),
            (try_end),
        (try_end),
        (try_begin),
            (neg|gt, ":var_41", ":var_15"),
            (assign, ":var_15", ":var_41"),
        (try_end),
        (assign, ":var_18", 42),
        (create_mesh_overlay, reg0, "mesh_white_plane"),
        (overlay_set_color, reg0, 16777215),
        (overlay_set_alpha, reg0, 208),
        (store_add, ":var_24", ":var_18", 0),
        (position_set_x, pos1, ":var_24"),
        (store_add, ":var_25", ":var_15", 10),
        (position_set_y, pos1, ":var_25"),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 36000),
        (position_set_y, pos1, 50),
        (overlay_set_size, reg0, pos1),
        (try_begin),
            (gt, ":var_2", 0),
            (assign, ":var_18", 280),
            (val_sub, ":var_15", 50),
            (create_text_overlay, reg0, "str_spectators", 0),
            (overlay_set_color, reg0, 16777215),
            (position_set_x, pos1, ":var_18"),
            (position_set_y, pos1, ":var_15"),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 1000),
            (position_set_y, pos1, 1000),
            (overlay_set_size, reg0, pos1),
            (create_text_overlay, reg0, "str_ping", 8),
            (overlay_set_color, reg0, 16777215),
            (store_add, ":var_24", ":var_18", 215),
            (position_set_x, pos1, ":var_24"),
            (position_set_y, pos1, ":var_15"),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 750),
            (position_set_y, pos1, 750),
            (overlay_set_size, reg0, pos1),
            (create_mesh_overlay, reg0, "mesh_white_plane"),
            (overlay_set_color, reg0, 16777215),
            (overlay_set_alpha, reg0, 208),
            (store_add, ":var_24", ":var_18", 0),
            (position_set_x, pos1, ":var_24"),
            (store_add, ":var_25", ":var_15", -10),
            (position_set_y, pos1, ":var_25"),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 12000),
            (position_set_y, pos1, 50),
            (overlay_set_size, reg0, pos1),
            (val_sub, ":var_15", 30),
            (assign, ":var_33", 12632256),
            (store_add, ":var_26", ":var_3", 1),
            (try_for_range, ":var_4", 0, ":var_26"),
                (store_add, ":var_5", ":var_4", 186),
                (troop_slot_eq, "trp_multiplayer_data", ":var_5", 1),
                (player_get_team_no, ":var_6", ":var_4"),
                (eq, ":var_6", 2),
                (troop_set_slot, "trp_multiplayer_data", ":var_5", 1),
                (try_begin),
                    (eq, ":var_9", ":var_4"),
                    (create_mesh_overlay, reg0, "mesh_white_plane"),
                    (overlay_set_color, reg0, 16777215),
                    (overlay_set_alpha, reg0, 53),
                    (store_add, ":var_24", ":var_18", 0),
                    (position_set_x, pos1, ":var_24"),
                    (store_add, ":var_25", ":var_15", 0),
                    (position_set_y, pos1, ":var_25"),
                    (overlay_set_position, reg0, pos1),
                    (position_set_x, pos1, 12000),
                    (position_set_y, pos1, 1000),
                    (overlay_set_size, reg0, pos1),
                (try_end),
                (str_store_player_username, s1, ":var_4"),
                (create_text_overlay, reg0, 1, 0),
                (overlay_set_color, reg0, ":var_33"),
                (position_set_x, pos1, 750),
                (position_set_y, pos1, 750),
                (overlay_set_size, reg0, pos1),
                (position_set_x, pos1, ":var_18"),
                (position_set_y, pos1, ":var_15"),
                (overlay_set_position, reg0, pos1),
                (player_get_ping, reg0, ":var_4"),
                (create_text_overlay, reg0, "str_reg0", 8),
                (overlay_set_color, reg0, ":var_33"),
                (position_set_x, pos1, 750),
                (position_set_y, pos1, 750),
                (overlay_set_size, reg0, pos1),
                (store_add, ":var_24", ":var_18", 215),
                (position_set_x, pos1, ":var_24"),
                (position_set_y, pos1, ":var_15"),
                (overlay_set_position, reg0, pos1),
                (val_sub, ":var_15", 20),
            (try_end),
        (try_end),
        (omit_key_once, key_mouse_scroll_up),
        (omit_key_once, key_mouse_scroll_down),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_run, [
        (store_trigger_param_1, ":var_0"),
        (try_begin),
            (this_or_next|key_clicked, key_mouse_scroll_up),
            (key_clicked, key_mouse_scroll_down),
            (omit_key_once, key_mouse_scroll_up),
            (omit_key_once, key_mouse_scroll_down),
        (try_end),
        (try_begin),
            (eq, "$g_multiplayer_stats_chart_opened_manually", 1),
            (neg|game_key_is_down, gk_leave),
            (assign, "$g_multiplayer_stats_chart_opened_manually", 0),
            (clear_omitted_keys),
            (presentation_set_duration, 0),
        (try_end),
        (try_begin),
            (store_mul, ":var_1", "$g_stats_chart_update_period", 1000),
            (gt, ":var_0", ":var_1"),
            (clear_omitted_keys),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_multiplayer_stats_chart"),
        (try_end),
    ]),
]),

("multiplayer_stats_chart_deathmatch", prsntf_manual_end_only|prsntf_read_only, 0, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (create_mesh_overlay, reg0, "mesh_mp_score_a"),
        (position_set_x, pos1, 295),
        (position_set_y, pos1, 115),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1000),
        (position_set_y, pos1, 1000),
        (overlay_set_size, reg0, pos1),
        (assign, ":var_0", 0),
        (assign, ":var_1", 0),
        (get_max_players, ":var_2"),
        (try_for_range, ":var_3", 0, ":var_2"),
            (store_add, ":var_4", ":var_3", 186),
            (try_begin),
                (player_is_active, ":var_3"),
                (troop_set_slot, "trp_multiplayer_data", ":var_4", 1),
                (player_get_team_no, ":var_5", ":var_3"),
                (try_begin),
                    (this_or_next|eq, ":var_5", 0),
                    (eq, ":var_5", 1),
                    (val_add, ":var_0", 1),
                (else_try),
                    (eq, ":var_5", 2),
                    (val_add, ":var_1", 1),
                (try_end),
            (else_try),
                (troop_set_slot, "trp_multiplayer_data", ":var_4", 0),
            (try_end),
        (try_end),
        (try_begin),
            (this_or_next|gt, "$g_multiplayer_num_bots_team_1", 0),
            (gt, "$g_multiplayer_num_bots_team_2", 0),
            (val_add, ":var_0", 1),
        (try_end),
        (store_add, ":var_6", ":var_0", ":var_1"),
        (str_clear, s0),
        (create_text_overlay, "$g_presentation_obj_stats_chart_deathmatch_container", 0, 131072),
        (position_set_x, pos1, 300),
        (position_set_y, pos1, 140),
        (overlay_set_position, "$g_presentation_obj_stats_chart_deathmatch_container", pos1),
        (position_set_x, pos1, 346),
        (position_set_y, pos1, 530),
        (overlay_set_area_size, "$g_presentation_obj_stats_chart_deathmatch_container", pos1),
        (set_container_overlay, "$g_presentation_obj_stats_chart_deathmatch_container"),
        (store_mul, ":var_7", ":var_6", 20),
        (val_add, ":var_7", 80),
        (try_begin),
            (gt, ":var_1", 0),
            (val_add, ":var_7", 70),
        (try_end),
        (try_begin),
            (ge, ":var_6", 17),
            (assign, "$g_stats_chart_update_period", 10),
        (else_try),
            (assign, "$g_stats_chart_update_period", 1),
        (try_end),
        (multiplayer_get_my_player, ":var_8"),
        (assign, ":var_9", ":var_7"),
        (assign, ":var_10", 42),
        (create_text_overlay, reg0, "str_player_name", 0),
        (overlay_set_color, reg0, 16777215),
        (position_set_x, pos1, ":var_10"),
        (position_set_y, pos1, ":var_9"),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg0, pos1),
        (create_text_overlay, reg0, "str_kills", 16),
        (overlay_set_color, reg0, 16777215),
        (store_add, ":var_11", ":var_10", 179),
        (position_set_x, pos1, ":var_11"),
        (position_set_y, pos1, ":var_9"),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg0, pos1),
        (create_text_overlay, reg0, "str_deaths", 16),
        (overlay_set_color, reg0, 16777215),
        (store_add, ":var_11", ":var_10", 233),
        (position_set_x, pos1, ":var_11"),
        (position_set_y, pos1, ":var_9"),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg0, pos1),
        (create_text_overlay, reg0, "str_ping", 16),
        (overlay_set_color, reg0, 16777215),
        (store_add, ":var_11", ":var_10", 282),
        (position_set_x, pos1, ":var_11"),
        (position_set_y, pos1, ":var_9"),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg0, pos1),
        (create_mesh_overlay, reg0, "mesh_white_plane"),
        (overlay_set_color, reg0, 16777215),
        (overlay_set_alpha, reg0, 208),
        (store_add, ":var_11", ":var_10", 0),
        (position_set_x, pos1, ":var_11"),
        (store_add, ":var_12", ":var_9", -10),
        (position_set_y, pos1, ":var_12"),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 15250),
        (position_set_y, pos1, 50),
        (overlay_set_size, reg0, pos1),
        (val_sub, ":var_9", 35),
        (store_add, ":var_13", ":var_2", 1),
        (try_for_range, ":var_14", 0, ":var_13"),
            (assign, ":var_15", -30030),
            (assign, ":var_16", -1),
            (try_for_range, ":var_3", 0, ":var_2"),
                (store_add, ":var_4", ":var_3", 186),
                (troop_slot_eq, "trp_multiplayer_data", ":var_4", 1),
                (player_get_team_no, ":var_5", ":var_3"),
                (this_or_next|eq, ":var_5", 0),
                (eq, ":var_5", 1),
                (player_get_kill_count, ":var_17", ":var_3"),
                (player_get_death_count, ":var_18", ":var_3"),
                (store_mul, ":var_19", ":var_17", 1000),
                (val_sub, ":var_19", ":var_18"),
                (this_or_next|gt, ":var_19", ":var_15"),
                (eq, ":var_19", -30030),
                (assign, ":var_15", ":var_19"),
                (assign, ":var_16", ":var_3"),
            (try_end),
            (try_begin),
                (ge, ":var_16", 0),
                (store_add, ":var_4", ":var_16", 186),
                (troop_set_slot, "trp_multiplayer_data", ":var_4", 0),
                (str_store_player_username, s1, ":var_16"),
                (try_begin),
                    (eq, ":var_8", ":var_16"),
                    (create_mesh_overlay, reg0, "mesh_white_plane"),
                    (overlay_set_color, reg0, 16777215),
                    (overlay_set_alpha, reg0, 53),
                    (store_add, ":var_11", ":var_10", 0),
                    (position_set_x, pos1, ":var_11"),
                    (store_add, ":var_12", ":var_9", 0),
                    (position_set_y, pos1, ":var_12"),
                    (overlay_set_position, reg0, pos1),
                    (position_set_x, pos1, 16000),
                    (position_set_y, pos1, 1000),
                    (overlay_set_size, reg0, pos1),
                (try_end),
                (create_text_overlay, reg0, 1, 0),
                (overlay_set_color, reg0, 16777215),
                (position_set_x, pos1, 750),
                (position_set_y, pos1, 750),
                (overlay_set_size, reg0, pos1),
                (position_set_x, pos1, ":var_10"),
                (position_set_y, pos1, ":var_9"),
                (overlay_set_position, reg0, pos1),
                (player_get_kill_count, reg0, ":var_16"),
                (create_text_overlay, reg0, "str_reg0", 8),
                (overlay_set_color, reg0, 16777215),
                (position_set_x, pos1, 750),
                (position_set_y, pos1, 750),
                (overlay_set_size, reg0, pos1),
                (store_add, ":var_11", ":var_10", 188),
                (position_set_x, pos1, ":var_11"),
                (position_set_y, pos1, ":var_9"),
                (overlay_set_position, reg0, pos1),
                (player_get_death_count, reg0, ":var_16"),
                (create_text_overlay, reg0, "str_reg0", 8),
                (overlay_set_color, reg0, 16777215),
                (position_set_x, pos1, 750),
                (position_set_y, pos1, 750),
                (overlay_set_size, reg0, pos1),
                (store_add, ":var_11", ":var_10", 238),
                (position_set_x, pos1, ":var_11"),
                (position_set_y, pos1, ":var_9"),
                (overlay_set_position, reg0, pos1),
                (player_get_ping, reg0, ":var_16"),
                (create_text_overlay, reg0, "str_reg0", 8),
                (overlay_set_color, reg0, 16777215),
                (position_set_x, pos1, 750),
                (position_set_y, pos1, 750),
                (overlay_set_size, reg0, pos1),
                (store_add, ":var_11", ":var_10", 288),
                (position_set_x, pos1, ":var_11"),
                (position_set_y, pos1, ":var_9"),
                (overlay_set_position, reg0, pos1),
                (val_sub, ":var_9", 20),
            (else_try),
                (store_add, ":var_20", "$g_multiplayer_num_bots_team_1", "$g_multiplayer_num_bots_team_2"),
                (ge, ":var_20", 1),
                (try_begin),
                    (gt, ":var_20", 1),
                    (assign, reg0, ":var_20"),
                    (create_text_overlay, reg0, "str_bots_reg0_agents", 0),
                (else_try),
                    (create_text_overlay, reg0, "str_bot_1_agent", 0),
                (try_end),
                (overlay_set_color, reg0, 13684944),
                (position_set_x, pos1, 750),
                (position_set_y, pos1, 750),
                (overlay_set_size, reg0, pos1),
                (position_set_x, pos1, ":var_10"),
                (position_set_y, pos1, ":var_9"),
                (overlay_set_position, reg0, pos1),
                (team_get_bot_kill_count, reg0, 0),
                (assign, ":var_21", reg0),
                (team_get_bot_kill_count, reg0, 1),
                (val_add, ":var_21", reg0),
                (assign, reg0, ":var_21"),
                (create_text_overlay, reg0, "str_reg0", 8),
                (overlay_set_color, reg0, 13684944),
                (position_set_x, pos1, 750),
                (position_set_y, pos1, 750),
                (overlay_set_size, reg0, pos1),
                (store_add, ":var_11", ":var_10", 188),
                (position_set_x, pos1, ":var_11"),
                (position_set_y, pos1, ":var_9"),
                (overlay_set_position, reg0, pos1),
                (team_get_bot_death_count, reg0, 0),
                (assign, ":var_22", reg0),
                (team_get_bot_death_count, reg0, 1),
                (val_add, ":var_22", reg0),
                (assign, reg0, ":var_22"),
                (create_text_overlay, reg0, "str_reg0", 8),
                (overlay_set_color, reg0, 13684944),
                (position_set_x, pos1, 750),
                (position_set_y, pos1, 750),
                (overlay_set_size, reg0, pos1),
                (store_add, ":var_11", ":var_10", 238),
                (position_set_x, pos1, ":var_11"),
                (position_set_y, pos1, ":var_9"),
                (overlay_set_position, reg0, pos1),
                (val_sub, ":var_9", 20),
                (assign, ":var_13", 0),
            (else_try),
                (assign, ":var_13", 0),
            (try_end),
        (try_end),
        (assign, ":var_10", 42),
        (create_mesh_overlay, reg0, "mesh_white_plane"),
        (overlay_set_color, reg0, 16777215),
        (overlay_set_alpha, reg0, 208),
        (store_add, ":var_11", ":var_10", 0),
        (position_set_x, pos1, ":var_11"),
        (store_add, ":var_12", ":var_9", 10),
        (position_set_y, pos1, ":var_12"),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 15250),
        (position_set_y, pos1, 50),
        (overlay_set_size, reg0, pos1),
        (try_begin),
            (gt, ":var_1", 0),
            (assign, ":var_10", 75),
            (val_sub, ":var_9", 50),
            (create_text_overlay, reg0, "str_spectators", 0),
            (overlay_set_color, reg0, 16777215),
            (position_set_x, pos1, ":var_10"),
            (position_set_y, pos1, ":var_9"),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 1000),
            (position_set_y, pos1, 1000),
            (overlay_set_size, reg0, pos1),
            (create_text_overlay, reg0, "str_ping", 16),
            (overlay_set_color, reg0, 16777215),
            (store_add, ":var_11", ":var_10", 218),
            (position_set_x, pos1, ":var_11"),
            (position_set_y, pos1, ":var_9"),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 750),
            (position_set_y, pos1, 750),
            (overlay_set_size, reg0, pos1),
            (create_mesh_overlay, reg0, "mesh_white_plane"),
            (overlay_set_color, reg0, 16777215),
            (overlay_set_alpha, reg0, 208),
            (store_add, ":var_11", ":var_10", 0),
            (position_set_x, pos1, ":var_11"),
            (store_add, ":var_12", ":var_9", -10),
            (position_set_y, pos1, ":var_12"),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 12000),
            (position_set_y, pos1, 50),
            (overlay_set_size, reg0, pos1),
            (val_sub, ":var_9", 30),
            (assign, ":var_23", 12632256),
            (store_add, ":var_13", ":var_2", 1),
            (try_for_range, ":var_3", 0, ":var_13"),
                (store_add, ":var_4", ":var_3", 186),
                (troop_slot_eq, "trp_multiplayer_data", ":var_4", 1),
                (player_get_team_no, ":var_5", ":var_3"),
                (eq, ":var_5", 2),
                (troop_set_slot, "trp_multiplayer_data", ":var_4", 1),
                (try_begin),
                    (eq, ":var_8", ":var_3"),
                    (create_mesh_overlay, reg0, "mesh_white_plane"),
                    (overlay_set_color, reg0, 16777215),
                    (overlay_set_alpha, reg0, 53),
                    (store_add, ":var_11", ":var_10", 0),
                    (position_set_x, pos1, ":var_11"),
                    (store_add, ":var_12", ":var_9", 0),
                    (position_set_y, pos1, ":var_12"),
                    (overlay_set_position, reg0, pos1),
                    (position_set_x, pos1, 12000),
                    (position_set_y, pos1, 1000),
                    (overlay_set_size, reg0, pos1),
                (try_end),
                (str_store_player_username, s1, ":var_3"),
                (create_text_overlay, reg0, 1, 0),
                (overlay_set_color, reg0, ":var_23"),
                (position_set_x, pos1, 750),
                (position_set_y, pos1, 750),
                (overlay_set_size, reg0, pos1),
                (position_set_x, pos1, ":var_10"),
                (position_set_y, pos1, ":var_9"),
                (overlay_set_position, reg0, pos1),
                (player_get_ping, reg0, ":var_3"),
                (create_text_overlay, reg0, "str_reg0", 8),
                (overlay_set_color, reg0, ":var_23"),
                (position_set_x, pos1, 750),
                (position_set_y, pos1, 750),
                (overlay_set_size, reg0, pos1),
                (store_add, ":var_11", ":var_10", 215),
                (position_set_x, pos1, ":var_11"),
                (position_set_y, pos1, ":var_9"),
                (overlay_set_position, reg0, pos1),
                (val_sub, ":var_9", 20),
            (try_end),
        (try_end),
        (omit_key_once, key_mouse_scroll_up),
        (omit_key_once, key_mouse_scroll_down),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_run, [
        (store_trigger_param_1, ":var_0"),
        (try_begin),
            (this_or_next|key_clicked, key_mouse_scroll_up),
            (key_clicked, key_mouse_scroll_down),
            (omit_key_once, key_mouse_scroll_up),
            (omit_key_once, key_mouse_scroll_down),
        (try_end),
        (try_begin),
            (eq, "$g_multiplayer_stats_chart_opened_manually", 1),
            (neg|game_key_is_down, gk_leave),
            (assign, "$g_multiplayer_stats_chart_opened_manually", 0),
            (clear_omitted_keys),
            (presentation_set_duration, 0),
        (try_end),
        (try_begin),
            (store_mul, ":var_1", "$g_stats_chart_update_period", 1000),
            (gt, ":var_0", ":var_1"),
            (clear_omitted_keys),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_multiplayer_stats_chart_deathmatch"),
        (try_end),
    ]),
]),

("multiplayer_escape_menu", prsntf_manual_end_only, 0, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (create_mesh_overlay, reg0, "mesh_mp_ingame_menu"),
        (position_set_x, pos1, 250),
        (position_set_y, pos1, 80),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1000),
        (position_set_y, pos1, 1000),
        (overlay_set_size, reg0, pos1),
        (str_clear, s0),
        (create_text_overlay, "$g_presentation_obj_escape_menu_container", 0, 131072),
        (position_set_x, pos1, 285),
        (position_set_y, pos1, 75),
        (overlay_set_position, "$g_presentation_obj_escape_menu_container", pos1),
        (position_set_x, pos1, 405),
        (position_set_y, pos1, 550),
        (overlay_set_area_size, "$g_presentation_obj_escape_menu_container", pos1),
        (set_container_overlay, "$g_presentation_obj_escape_menu_container"),
        (assign, ":var_0", 500),
        (create_text_overlay, reg0, "str_choose_an_option", 0),
        (overlay_set_color, reg0, 16777215),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, ":var_0"),
        (overlay_set_position, reg0, pos1),
        (val_sub, ":var_0", 40),
        (create_button_overlay, "$g_presentation_obj_escape_menu_1", "str_choose_faction", 0),
        (overlay_set_color, "$g_presentation_obj_escape_menu_1", 16777215),
        (multiplayer_get_my_team, ":var_1"),
        (assign, "$g_presentation_obj_escape_menu_2", -1),
        (assign, "$g_presentation_obj_escape_menu_3", -1),
        (assign, "$g_presentation_obj_escape_menu_6", -1),
        (assign, "$g_presentation_obj_escape_menu_7", -1),
        (assign, "$g_presentation_obj_escape_menu_8", -1),
        (assign, "$g_presentation_obj_escape_menu_9", -1),
        (assign, "$g_presentation_obj_escape_menu_10", -1),
        (assign, "$g_presentation_obj_escape_menu_11", -1),
        (assign, "$g_presentation_obj_escape_menu_12", -1),
        (assign, "$g_presentation_obj_escape_menu_13", -1),
        (try_begin),
            (neg|ge, ":var_1", 2),
            (create_button_overlay, "$g_presentation_obj_escape_menu_2", "str_choose_troop", 0),
            (overlay_set_color, "$g_presentation_obj_escape_menu_2", 16777215),
            (multiplayer_get_my_troop, ":var_2"),
            (try_begin),
                (ge, ":var_2", 0),
                (create_button_overlay, "$g_presentation_obj_escape_menu_3", "str_choose_items", 0),
                (overlay_set_color, "$g_presentation_obj_escape_menu_3", 16777215),
            (try_end),
        (try_end),
        (create_button_overlay, "$g_presentation_obj_escape_menu_4", "str_options", 0),
        (overlay_set_color, "$g_presentation_obj_escape_menu_4", 16777215),
        (create_button_overlay, "$g_presentation_obj_escape_menu_5", "str_redefine_keys", 0),
        (overlay_set_color, "$g_presentation_obj_escape_menu_5", 16777215),
        (create_button_overlay, "$g_presentation_obj_escape_menu_13", "@Show game rules", 0),
        (overlay_set_color, "$g_presentation_obj_escape_menu_13", 16777215),
        (multiplayer_get_my_player, ":var_3"),
        (try_begin),
            (this_or_next|eq, "$g_multiplayer_maps_voteable", 1),
            (this_or_next|eq, "$g_multiplayer_factions_voteable", 1),
            (this_or_next|gt, "$g_multiplayer_num_bots_voteable", 0),
            (this_or_next|eq, "$g_multiplayer_kick_voteable", 1),
            (eq, "$g_multiplayer_ban_voteable", 1),
            (create_button_overlay, "$g_presentation_obj_escape_menu_6", "str_submit_a_poll", 0),
            (overlay_set_color, "$g_presentation_obj_escape_menu_6", 16777215),
            (assign, "$g_presentation_obj_escape_menu_6_available", 1),
            (try_begin),
                (ge, ":var_3", 0),
                (player_get_slot, ":var_4", ":var_3", 26),
                (store_mission_timer_a, ":var_5"),
                (neg|ge, ":var_5", ":var_4"),
                (overlay_set_color, "$g_presentation_obj_escape_menu_6", 8947848),
                (overlay_set_hilight_color, "$g_presentation_obj_escape_menu_6", 8947848),
                (assign, "$g_presentation_obj_escape_menu_6_available", 0),
            (try_end),
        (try_end),
        (try_begin),
            (ge, ":var_3", 0),
            (player_is_admin, ":var_3"),
            (create_button_overlay, "$g_presentation_obj_escape_menu_7", "str_administrator_panel", 0),
            (overlay_set_color, "$g_presentation_obj_escape_menu_7", 16777215),
            (create_button_overlay, "$g_presentation_obj_escape_menu_8", "str_kick_player", 0),
            (overlay_set_color, "$g_presentation_obj_escape_menu_8", 16777215),
            (create_button_overlay, "$g_presentation_obj_escape_menu_9", "str_ban_player", 0),
            (overlay_set_color, "$g_presentation_obj_escape_menu_9", 16777215),
        (try_end),
        (create_button_overlay, "$g_presentation_obj_escape_menu_11", "str_mute_player", 0),
        (overlay_set_color, "$g_presentation_obj_escape_menu_11", 16777215),
        (try_begin),
            (assign, "$g_presentation_obj_escape_menu_12", -1),
            (assign, ":var_6", 0),
            (get_max_players, ":var_7"),
            (try_for_range, ":var_8", 0, ":var_7"),
                (player_is_active, ":var_8"),
                (player_get_is_muted, ":var_9", ":var_8"),
                (eq, ":var_9", 1),
                (assign, ":var_6", 1),
            (try_end),
            (eq, ":var_6", 1),
            (create_button_overlay, "$g_presentation_obj_escape_menu_12", "str_unmute_player", 0),
            (overlay_set_color, "$g_presentation_obj_escape_menu_12", 16777215),
        (try_end),
        (create_button_overlay, "$g_presentation_obj_escape_menu_10", "str_quit", 0),
        (overlay_set_color, "$g_presentation_obj_escape_menu_10", 16777215),
        (position_set_x, pos1, 130),
        (position_set_y, pos1, ":var_0"),
        (overlay_set_position, "$g_presentation_obj_escape_menu_1", pos1),
        (try_begin),
            (ge, "$g_presentation_obj_escape_menu_2", 0),
            (val_sub, ":var_0", 40),
            (position_set_y, pos1, ":var_0"),
            (overlay_set_position, "$g_presentation_obj_escape_menu_2", pos1),
        (try_end),
        (try_begin),
            (ge, "$g_presentation_obj_escape_menu_3", 0),
            (val_sub, ":var_0", 40),
            (position_set_y, pos1, ":var_0"),
            (overlay_set_position, "$g_presentation_obj_escape_menu_3", pos1),
        (try_end),
        (val_sub, ":var_0", 40),
        (position_set_y, pos1, ":var_0"),
        (overlay_set_position, "$g_presentation_obj_escape_menu_4", pos1),
        (val_sub, ":var_0", 40),
        (position_set_y, pos1, ":var_0"),
        (overlay_set_position, "$g_presentation_obj_escape_menu_5", pos1),
        (val_sub, ":var_0", 40),
        (position_set_y, pos1, ":var_0"),
        (overlay_set_position, "$g_presentation_obj_escape_menu_13", pos1),
        (try_begin),
            (ge, "$g_presentation_obj_escape_menu_6", 0),
            (val_sub, ":var_0", 40),
            (position_set_y, pos1, ":var_0"),
            (overlay_set_position, "$g_presentation_obj_escape_menu_6", pos1),
        (try_end),
        (try_begin),
            (ge, "$g_presentation_obj_escape_menu_7", 0),
            (val_sub, ":var_0", 40),
            (position_set_y, pos1, ":var_0"),
            (overlay_set_position, "$g_presentation_obj_escape_menu_7", pos1),
        (try_end),
        (try_begin),
            (ge, "$g_presentation_obj_escape_menu_8", 0),
            (val_sub, ":var_0", 40),
            (position_set_y, pos1, ":var_0"),
            (overlay_set_position, "$g_presentation_obj_escape_menu_8", pos1),
        (try_end),
        (try_begin),
            (ge, "$g_presentation_obj_escape_menu_9", 0),
            (val_sub, ":var_0", 40),
            (position_set_y, pos1, ":var_0"),
            (overlay_set_position, "$g_presentation_obj_escape_menu_9", pos1),
        (try_end),
        (val_sub, ":var_0", 40),
        (position_set_y, pos1, ":var_0"),
        (overlay_set_position, "$g_presentation_obj_escape_menu_11", pos1),
        (try_begin),
            (ge, "$g_presentation_obj_escape_menu_12", 0),
            (val_sub, ":var_0", 40),
            (position_set_y, pos1, ":var_0"),
            (overlay_set_position, "$g_presentation_obj_escape_menu_12", pos1),
        (try_end),
        (val_sub, ":var_0", 40),
        (position_set_y, pos1, ":var_0"),
        (overlay_set_position, "$g_presentation_obj_escape_menu_10", pos1),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":var_0"),
        (try_begin),
            (eq, ":var_0", "$g_presentation_obj_escape_menu_1"),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_multiplayer_team_select"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_escape_menu_2"),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_multiplayer_troop_select"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_escape_menu_3"),
            (presentation_set_duration, 0),
            (assign, "$g_presentation_state", 0),
            (start_presentation, "prsnt_multiplayer_item_select"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_escape_menu_4"),
            (presentation_set_duration, 0),
            (change_screen_options),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_escape_menu_5"),
            (presentation_set_duration, 0),
            (change_screen_controls),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_escape_menu_6"),
            (eq, "$g_presentation_obj_escape_menu_6_available", 1),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_multiplayer_poll_menu"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_escape_menu_7"),
            (presentation_set_duration, 0),
            (multiplayer_send_message_to_server, 18),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_escape_menu_8"),
            (presentation_set_duration, 0),
            (assign, "$g_multiplayer_players_list_action_type", 3),
            (start_presentation, "prsnt_multiplayer_show_players_list"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_escape_menu_9"),
            (presentation_set_duration, 0),
            (assign, "$g_multiplayer_players_list_action_type", 4),
            (start_presentation, "prsnt_multiplayer_show_players_list"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_escape_menu_10"),
            (presentation_set_duration, 0),
            (finish_mission, 0),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_escape_menu_11"),
            (presentation_set_duration, 0),
            (assign, "$g_multiplayer_players_list_action_type", 5),
            (start_presentation, "prsnt_multiplayer_show_players_list"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_escape_menu_12"),
            (presentation_set_duration, 0),
            (assign, "$g_multiplayer_players_list_action_type", 6),
            (start_presentation, "prsnt_multiplayer_show_players_list"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_escape_menu_13"),
            (presentation_set_duration, 0),
            (multiplayer_send_message_to_server, 45),
        (try_end),
    ]),
    (ti_on_presentation_run, [
        (store_trigger_param_1, ":var_0"),
        (try_begin),
            (key_clicked, key_escape),
            (gt, ":var_0", 200),
            (presentation_set_duration, 0),
        (try_end),
    ]),
]),

("multiplayer_poll_menu", prsntf_manual_end_only, 0, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (create_mesh_overlay, reg0, "mesh_mp_ingame_menu"),
        (position_set_x, pos1, 250),
        (position_set_y, pos1, 80),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1000),
        (position_set_y, pos1, 1000),
        (overlay_set_size, reg0, pos1),
        (str_clear, s0),
        (create_text_overlay, "$g_presentation_obj_poll_menu_container", 0, 131072),
        (position_set_x, pos1, 285),
        (position_set_y, pos1, 125),
        (overlay_set_position, "$g_presentation_obj_poll_menu_container", pos1),
        (position_set_x, pos1, 405),
        (position_set_y, pos1, 500),
        (overlay_set_area_size, "$g_presentation_obj_poll_menu_container", pos1),
        (set_container_overlay, "$g_presentation_obj_poll_menu_container"),
        (assign, "$g_presentation_obj_poll_menu_1", -1),
        (assign, "$g_presentation_obj_poll_menu_4", -1),
        (assign, "$g_presentation_obj_poll_menu_5", -1),
        (assign, ":var_0", 450),
        (create_text_overlay, reg0, "str_choose_a_poll_type", 0),
        (overlay_set_color, reg0, 16777215),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, ":var_0"),
        (overlay_set_position, reg0, pos1),
        (val_sub, ":var_0", 40),
        (position_set_x, pos1, 60),
        (try_begin),
            (eq, "$g_multiplayer_maps_voteable", 1),
            (create_button_overlay, "$g_presentation_obj_poll_menu_1", "str_poll_for_changing_the_map", 0),
            (overlay_set_color, "$g_presentation_obj_poll_menu_1", 16777215),
            (position_set_y, pos1, ":var_0"),
            (overlay_set_position, "$g_presentation_obj_poll_menu_1", pos1),
            (val_sub, ":var_0", 40),
        (try_end),
        (try_begin),
            (eq, "$g_multiplayer_factions_voteable", 1),
            (create_button_overlay, "$g_presentation_obj_poll_menu_4", "str_poll_for_changing_the_map_and_factions", 0),
            (overlay_set_color, "$g_presentation_obj_poll_menu_4", 16777215),
            (position_set_y, pos1, ":var_0"),
            (overlay_set_position, "$g_presentation_obj_poll_menu_4", pos1),
            (val_sub, ":var_0", 40),
        (try_end),
        (try_begin),
            (gt, "$g_multiplayer_num_bots_voteable", 0),
            (create_button_overlay, "$g_presentation_obj_poll_menu_5", "str_poll_for_changing_number_of_bots", 0),
            (overlay_set_color, "$g_presentation_obj_poll_menu_5", 16777215),
            (position_set_y, pos1, ":var_0"),
            (overlay_set_position, "$g_presentation_obj_poll_menu_5", pos1),
            (val_sub, ":var_0", 40),
        (try_end),
        (try_begin),
            (eq, "$g_multiplayer_kick_voteable", 1),
            (create_button_overlay, "$g_presentation_obj_poll_menu_2", "str_poll_for_kicking_a_player", 0),
            (overlay_set_color, "$g_presentation_obj_poll_menu_2", 16777215),
            (position_set_y, pos1, ":var_0"),
            (overlay_set_position, "$g_presentation_obj_poll_menu_2", pos1),
            (val_sub, ":var_0", 40),
        (try_end),
        (try_begin),
            (eq, "$g_multiplayer_ban_voteable", 1),
            (create_button_overlay, "$g_presentation_obj_poll_menu_3", "str_poll_for_banning_a_player", 0),
            (overlay_set_color, "$g_presentation_obj_poll_menu_3", 16777215),
            (position_set_y, pos1, ":var_0"),
            (overlay_set_position, "$g_presentation_obj_poll_menu_3", pos1),
        (try_end),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":var_0"),
        (try_begin),
            (eq, ":var_0", "$g_presentation_obj_poll_menu_1"),
            (presentation_set_duration, 0),
            (assign, "$g_multiplayer_maps_list_action_type", 1),
            (start_presentation, "prsnt_multiplayer_show_maps_list"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_poll_menu_2"),
            (presentation_set_duration, 0),
            (assign, "$g_multiplayer_players_list_action_type", 1),
            (start_presentation, "prsnt_multiplayer_show_players_list"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_poll_menu_3"),
            (presentation_set_duration, 0),
            (assign, "$g_multiplayer_players_list_action_type", 2),
            (start_presentation, "prsnt_multiplayer_show_players_list"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_poll_menu_4"),
            (presentation_set_duration, 0),
            (assign, "$g_multiplayer_maps_list_action_type", 2),
            (start_presentation, "prsnt_multiplayer_show_maps_list"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_poll_menu_5"),
            (presentation_set_duration, 0),
            (assign, "$g_multiplayer_number_of_bots_list_action_type", 1),
            (start_presentation, "prsnt_multiplayer_show_number_of_bots_list"),
        (try_end),
    ]),
    (ti_on_presentation_run, [
        (store_trigger_param_1, ":var_0"),
        (try_begin),
            (key_clicked, key_escape),
            (gt, ":var_0", 200),
            (presentation_set_duration, 0),
        (try_end),
    ]),
]),

("multiplayer_show_players_list", prsntf_manual_end_only, 0, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (create_mesh_overlay, reg0, "mesh_mp_ingame_menu"),
        (position_set_x, pos1, 250),
        (position_set_y, pos1, 80),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1000),
        (position_set_y, pos1, 1000),
        (overlay_set_size, reg0, pos1),
        (str_clear, s0),
        (create_text_overlay, "$g_presentation_obj_show_players_1", 0, 131072),
        (position_set_x, pos1, 285),
        (position_set_y, pos1, 125),
        (overlay_set_position, "$g_presentation_obj_show_players_1", pos1),
        (position_set_x, pos1, 405),
        (position_set_y, pos1, 500),
        (overlay_set_area_size, "$g_presentation_obj_show_players_1", pos1),
        (set_container_overlay, "$g_presentation_obj_show_players_1"),
        (multiplayer_get_my_player, ":var_0"),
        (assign, ":var_1", 10),
        (get_max_players, ":var_2"),
        (try_for_range, ":var_3", 1, ":var_2"),
            (player_is_active, ":var_3"),
            (assign, ":var_4", 0),
            (try_begin),
                (neg|eq, "$g_multiplayer_players_list_action_type", 5),
                (neg|eq, "$g_multiplayer_players_list_action_type", 6),
                (assign, ":var_4", 1),
            (else_try),
                (eq, "$g_multiplayer_players_list_action_type", 5),
                (neg|eq, ":var_3", ":var_0"),
                (player_get_is_muted, ":var_5", ":var_3"),
                (eq, ":var_5", 0),
                (assign, ":var_4", 1),
            (else_try),
                (eq, "$g_multiplayer_players_list_action_type", 6),
                (neg|eq, ":var_3", ":var_0"),
                (player_get_is_muted, ":var_5", ":var_3"),
                (eq, ":var_5", 1),
                (assign, ":var_4", 1),
            (try_end),
            (eq, ":var_4", 1),
            (val_add, ":var_1", 40),
        (try_end),
        (create_text_overlay, reg0, "str_choose_a_player", 0),
        (overlay_set_color, reg0, 16777215),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg0, pos1),
        (val_sub, ":var_1", 40),
        (get_max_players, ":var_2"),
        (try_for_range, ":var_3", 1, ":var_2"),
            (player_is_active, ":var_3"),
            (player_set_slot, ":var_3", 22, -1),
            (assign, ":var_4", 0),
            (try_begin),
                (neg|eq, "$g_multiplayer_players_list_action_type", 5),
                (neg|eq, "$g_multiplayer_players_list_action_type", 6),
                (assign, ":var_4", 1),
            (else_try),
                (eq, "$g_multiplayer_players_list_action_type", 5),
                (neg|eq, ":var_3", ":var_0"),
                (player_get_is_muted, ":var_5", ":var_3"),
                (eq, ":var_5", 0),
                (assign, ":var_4", 1),
            (else_try),
                (eq, "$g_multiplayer_players_list_action_type", 6),
                (neg|eq, ":var_3", ":var_0"),
                (player_get_is_muted, ":var_5", ":var_3"),
                (eq, ":var_5", 1),
                (assign, ":var_4", 1),
            (try_end),
            (eq, ":var_4", 1),
            (str_store_player_username, s0, ":var_3"),
            (create_button_overlay, ":var_6", 0, 0),
            (overlay_set_color, ":var_6", 16777215),
            (position_set_x, pos1, 130),
            (position_set_y, pos1, ":var_1"),
            (overlay_set_position, ":var_6", pos1),
            (val_sub, ":var_1", 40),
            (player_set_slot, ":var_3", 22, ":var_6"),
        (try_end),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":var_0"),
        (get_max_players, ":var_1"),
        (try_for_range, ":var_2", 1, ":var_1"),
            (player_is_active, ":var_2"),
            (player_slot_eq, ":var_2", 22, ":var_0"),
            (try_begin),
                (is_between, "$g_multiplayer_players_list_action_type", 1, 3),
                (try_begin),
                    (multiplayer_get_my_player, ":var_3"),
                    (ge, ":var_3", 0),
                    (multiplayer_send_2_int_to_server, 21, "$g_multiplayer_players_list_action_type", ":var_2"),
                    (store_mission_timer_a, ":var_4"),
                    (val_add, ":var_4", 900),
                    (player_set_slot, ":var_3", 26, ":var_4"),
                (try_end),
            (else_try),
                (eq, "$g_multiplayer_players_list_action_type", 3),
                (multiplayer_send_int_to_server, 23, ":var_2"),
            (else_try),
                (eq, "$g_multiplayer_players_list_action_type", 4),
                (multiplayer_send_int_to_server, 24, ":var_2"),
            (else_try),
                (eq, "$g_multiplayer_players_list_action_type", 5),
                (player_set_is_muted, ":var_2", 1),
            (else_try),
                (eq, "$g_multiplayer_players_list_action_type", 6),
                (player_set_is_muted, ":var_2", 0),
            (try_end),
            (assign, ":var_1", 0),
            (presentation_set_duration, 0),
        (try_end),
    ]),
    (ti_on_presentation_run, [
        (store_trigger_param_1, ":var_0"),
        (try_begin),
            (key_clicked, key_escape),
            (gt, ":var_0", 200),
            (presentation_set_duration, 0),
        (try_end),
    ]),
]),

("multiplayer_show_maps_list", prsntf_manual_end_only, 0, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (create_mesh_overlay, reg0, "mesh_mp_ingame_menu"),
        (position_set_x, pos1, 250),
        (position_set_y, pos1, 80),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1000),
        (position_set_y, pos1, 1000),
        (overlay_set_size, reg0, pos1),
        (str_clear, s0),
        (create_text_overlay, "$g_presentation_obj_show_maps_list_menu_container", 0, 131072),
        (position_set_x, pos1, 285),
        (position_set_y, pos1, 125),
        (overlay_set_position, "$g_presentation_obj_show_maps_list_menu_container", pos1),
        (position_set_x, pos1, 405),
        (position_set_y, pos1, 500),
        (overlay_set_area_size, "$g_presentation_obj_show_maps_list_menu_container", pos1),
        (set_container_overlay, "$g_presentation_obj_show_maps_list_menu_container"),
        (call_script, "script_multiplayer_fill_map_game_types", "$g_multiplayer_game_type"),
        (assign, ":var_0", reg0),
        (store_mul, ":var_1", ":var_0", 40),
        (val_add, ":var_1", 10),
        (create_text_overlay, reg0, "str_choose_a_map", 0),
        (overlay_set_color, reg0, 16777215),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg0, pos1),
        (val_sub, ":var_1", 40),
        (assign, ":var_2", -1),
        (try_for_range, ":var_3", 0, ":var_0"),
            (store_add, ":var_4", ":var_3", 0),
            (troop_get_slot, ":var_5", "trp_multiplayer_data", ":var_4"),
            (store_sub, ":var_6", ":var_5", "scn_multi_scene_1"),
            (val_add, ":var_6", "str_multi_scene_1"),
            (str_store_string, s0, ":var_6"),
            (create_button_overlay, ":var_2", 0, 0),
            (overlay_set_color, ":var_2", 16777215),
            (position_set_x, pos1, 100),
            (position_set_y, pos1, ":var_1"),
            (overlay_set_position, ":var_2", pos1),
            (val_sub, ":var_1", 40),
        (try_end),
        (store_add, "$g_show_maps_list_button_list_end_index", ":var_2", 1),
        (store_sub, "$g_show_maps_list_button_list_first_index", "$g_show_maps_list_button_list_end_index", ":var_0"),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":var_0"),
        (try_for_range, ":var_1", "$g_show_maps_list_button_list_first_index", "$g_show_maps_list_button_list_end_index"),
            (eq, ":var_0", ":var_1"),
            (call_script, "script_multiplayer_fill_map_game_types", "$g_multiplayer_game_type"),
            (store_sub, ":var_2", ":var_0", "$g_show_maps_list_button_list_first_index"),
            (val_add, ":var_2", 0),
            (troop_get_slot, ":var_3", "trp_multiplayer_data", ":var_2"),
            (presentation_set_duration, 0),
            (try_begin),
                (eq, "$g_multiplayer_maps_list_action_type", 1),
                (try_begin),
                    (multiplayer_get_my_player, ":var_4"),
                    (ge, ":var_4", 0),
                    (multiplayer_send_2_int_to_server, 21, 0, ":var_3"),
                    (store_mission_timer_a, ":var_5"),
                    (val_add, ":var_5", 900),
                    (player_set_slot, ":var_4", 26, ":var_5"),
                (try_end),
            (else_try),
                (assign, "$g_multiplayer_factions_list_action_type", 1),
                (assign, "$g_multiplayer_poll_for_map_and_faction_data_map", ":var_3"),
                (start_presentation, "prsnt_multiplayer_show_factions_list"),
            (try_end),
            (assign, "$g_show_maps_list_button_list_end_index", 0),
        (try_end),
    ]),
    (ti_on_presentation_run, [
        (store_trigger_param_1, ":var_0"),
        (try_begin),
            (key_clicked, key_escape),
            (gt, ":var_0", 200),
            (presentation_set_duration, 0),
        (try_end),
    ]),
]),

("multiplayer_show_factions_list", prsntf_manual_end_only, 0, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (create_mesh_overlay, reg0, "mesh_mp_ingame_menu"),
        (position_set_x, pos1, 250),
        (position_set_y, pos1, 80),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1000),
        (position_set_y, pos1, 1000),
        (overlay_set_size, reg0, pos1),
        (str_clear, s0),
        (create_text_overlay, "$g_presentation_obj_show_factions_list_menu_container", 0, 131072),
        (position_set_x, pos1, 285),
        (position_set_y, pos1, 125),
        (overlay_set_position, "$g_presentation_obj_show_factions_list_menu_container", pos1),
        (position_set_x, pos1, 405),
        (position_set_y, pos1, 500),
        (overlay_set_area_size, "$g_presentation_obj_show_factions_list_menu_container", pos1),
        (set_container_overlay, "$g_presentation_obj_show_factions_list_menu_container"),
        (store_sub, ":var_0", "fac_kingdoms_end", "fac_kingdom_1"),
        (try_begin),
            (eq, "$g_multiplayer_factions_list_action_type", 2),
            (val_sub, ":var_0", 1),
        (try_end),
        (store_mul, ":var_1", ":var_0", 40),
        (val_add, ":var_1", 10),
        (assign, reg0, "$g_multiplayer_factions_list_action_type"),
        (create_text_overlay, reg0, "str_choose_a_faction_for_team_reg0", 0),
        (overlay_set_color, reg0, 16777215),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg0, pos1),
        (val_sub, ":var_1", 40),
        (assign, ":var_2", -1),
        (try_for_range, ":var_3", "fac_kingdom_1", "fac_kingdoms_end"),
            (this_or_next|eq, "$g_multiplayer_factions_list_action_type", 1),
            (neg|eq, "$g_multiplayer_poll_for_map_and_faction_data_faction_1", ":var_3"),
            (str_store_faction_name, s0, ":var_3"),
            (create_button_overlay, ":var_2", 0, 0),
            (overlay_set_color, ":var_2", 16777215),
            (position_set_x, pos1, 100),
            (position_set_y, pos1, ":var_1"),
            (overlay_set_position, ":var_2", pos1),
            (val_sub, ":var_1", 40),
        (try_end),
        (store_add, "$g_show_factions_list_button_list_end_index", ":var_2", 1),
        (store_sub, "$g_show_factions_list_button_list_first_index", "$g_show_factions_list_button_list_end_index", ":var_0"),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":var_0"),
        (try_for_range, ":var_1", "$g_show_factions_list_button_list_first_index", "$g_show_factions_list_button_list_end_index"),
            (eq, ":var_0", ":var_1"),
            (store_sub, ":var_2", ":var_0", "$g_show_factions_list_button_list_first_index"),
            (val_add, ":var_2", "fac_kingdom_1"),
            (presentation_set_duration, 0),
            (try_begin),
                (eq, "$g_multiplayer_factions_list_action_type", 2),
                (try_begin),
                    (ge, ":var_2", "$g_multiplayer_poll_for_map_and_faction_data_faction_1"),
                    (val_add, ":var_2", 1),
                (try_end),
                (try_begin),
                    (multiplayer_get_my_player, ":var_3"),
                    (ge, ":var_3", 0),
                    (multiplayer_send_4_int_to_server, 21, 3, "$g_multiplayer_poll_for_map_and_faction_data_map", "$g_multiplayer_poll_for_map_and_faction_data_faction_1", ":var_2"),
                    (store_mission_timer_a, ":var_4"),
                    (val_add, ":var_4", 900),
                    (player_set_slot, ":var_3", 26, ":var_4"),
                (try_end),
            (else_try),
                (assign, "$g_multiplayer_factions_list_action_type", 2),
                (assign, "$g_multiplayer_poll_for_map_and_faction_data_faction_1", ":var_2"),
                (start_presentation, "prsnt_multiplayer_show_factions_list"),
            (try_end),
            (assign, "$g_show_factions_list_button_list_end_index", 0),
        (try_end),
    ]),
    (ti_on_presentation_run, [
        (store_trigger_param_1, ":var_0"),
        (try_begin),
            (key_clicked, key_escape),
            (gt, ":var_0", 200),
            (presentation_set_duration, 0),
        (try_end),
    ]),
]),

("multiplayer_show_number_of_bots_list", prsntf_manual_end_only, 0, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (create_mesh_overlay, reg0, "mesh_mp_ingame_menu"),
        (position_set_x, pos1, 250),
        (position_set_y, pos1, 80),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1000),
        (position_set_y, pos1, 1000),
        (overlay_set_size, reg0, pos1),
        (str_clear, s0),
        (create_text_overlay, "$g_presentation_obj_show_number_of_bots_list_menu_container", 0, 131072),
        (position_set_x, pos1, 285),
        (position_set_y, pos1, 125),
        (overlay_set_position, "$g_presentation_obj_show_number_of_bots_list_menu_container", pos1),
        (position_set_x, pos1, 405),
        (position_set_y, pos1, 500),
        (overlay_set_area_size, "$g_presentation_obj_show_number_of_bots_list_menu_container", pos1),
        (set_container_overlay, "$g_presentation_obj_show_number_of_bots_list_menu_container"),
        (assign, ":var_0", 0),
        (store_add, ":var_1", "$g_multiplayer_num_bots_voteable", 1),
        (try_for_range, ":var_2", 0, ":var_1"),
            (assign, ":var_3", ":var_2"),
            (val_mod, ":var_3", 5),
            (this_or_next|neg|ge, ":var_2", 10),
            (eq, ":var_3", 0),
            (val_add, ":var_0", 1),
        (try_end),
        (store_mul, ":var_4", ":var_0", 40),
        (val_add, ":var_4", 10),
        (assign, reg0, "$g_multiplayer_number_of_bots_list_action_type"),
        (create_text_overlay, reg0, "str_choose_number_of_bots_for_team_reg0", 0),
        (overlay_set_color, reg0, 16777215),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, ":var_4"),
        (overlay_set_position, reg0, pos1),
        (val_sub, ":var_4", 40),
        (assign, ":var_5", -1),
        (try_for_range, ":var_2", 0, ":var_1"),
            (assign, ":var_3", ":var_2"),
            (val_mod, ":var_3", 5),
            (this_or_next|neg|ge, ":var_2", 10),
            (eq, ":var_3", 0),
            (assign, reg0, ":var_2"),
            (str_store_string, s0, "str_reg0"),
            (create_button_overlay, ":var_5", 0, 0),
            (overlay_set_color, ":var_5", 16777215),
            (position_set_x, pos1, 100),
            (position_set_y, pos1, ":var_4"),
            (overlay_set_position, ":var_5", pos1),
            (val_sub, ":var_4", 40),
        (try_end),
        (store_add, "$g_show_number_of_bots_list_button_list_end_index", ":var_5", 1),
        (store_sub, "$g_show_number_of_bots_list_button_list_first_index", "$g_show_number_of_bots_list_button_list_end_index", ":var_0"),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":var_0"),
        (try_for_range, ":var_1", "$g_show_number_of_bots_list_button_list_first_index", "$g_show_number_of_bots_list_button_list_end_index"),
            (eq, ":var_0", ":var_1"),
            (store_sub, ":var_2", ":var_0", "$g_show_number_of_bots_list_button_list_first_index"),
            (try_begin),
                (neg|ge, ":var_2", 10),
                (assign, ":var_3", ":var_2"),
            (else_try),
                (store_sub, ":var_3", ":var_2", 8),
                (val_mul, ":var_3", 5),
            (try_end),
            (presentation_set_duration, 0),
            (try_begin),
                (eq, "$g_multiplayer_number_of_bots_list_action_type", 2),
                (try_begin),
                    (multiplayer_get_my_player, ":var_4"),
                    (ge, ":var_4", 0),
                    (multiplayer_send_3_int_to_server, 21, 4, "$g_multiplayer_poll_number_of_bots_team_1", ":var_3"),
                    (store_mission_timer_a, ":var_5"),
                    (val_add, ":var_5", 900),
                    (player_set_slot, ":var_4", 26, ":var_5"),
                (try_end),
            (else_try),
                (assign, "$g_multiplayer_number_of_bots_list_action_type", 2),
                (assign, "$g_multiplayer_poll_number_of_bots_team_1", ":var_3"),
                (start_presentation, "prsnt_multiplayer_show_number_of_bots_list"),
            (try_end),
            (assign, "$g_show_number_of_bots_list_button_list_end_index", 0),
        (try_end),
    ]),
    (ti_on_presentation_run, [
        (store_trigger_param_1, ":var_0"),
        (try_begin),
            (key_clicked, key_escape),
            (gt, ":var_0", 200),
            (presentation_set_duration, 0),
        (try_end),
    ]),
]),

("multiplayer_poll", prsntf_manual_end_only|prsntf_read_only, 0, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (create_mesh_overlay, reg0, "mesh_white_plane"),
        (overlay_set_color, reg0, 0),
        (overlay_set_alpha, reg0, 68),
        (position_set_x, pos1, 50),
        (position_set_y, pos1, 50),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 37500),
        (position_set_y, pos1, 4500),
        (overlay_set_size, reg0, pos1),
        (try_begin),
            (eq, "$g_multiplayer_poll_to_show", 0),
            (store_sub, ":var_0", "$g_multiplayer_poll_value_to_show", "scn_multi_scene_1"),
            (val_add, ":var_0", "str_multi_scene_1"),
            (str_store_string, s0, ":var_0"),
            (create_text_overlay, reg0, "str_poll_change_map", 16),
        (else_try),
            (eq, "$g_multiplayer_poll_to_show", 1),
            (str_store_player_username, s0, "$g_multiplayer_poll_value_to_show"),
            (create_text_overlay, reg0, "str_poll_kick_player", 16),
        (else_try),
            (eq, "$g_multiplayer_poll_to_show", 2),
            (str_store_player_username, s0, "$g_multiplayer_poll_value_to_show"),
            (create_text_overlay, reg0, "str_poll_ban_player", 16),
        (else_try),
            (eq, "$g_multiplayer_poll_to_show", 3),
            (store_sub, ":var_0", "$g_multiplayer_poll_value_to_show", "scn_multi_scene_1"),
            (val_add, ":var_0", "str_multi_scene_1"),
            (str_store_string, s0, ":var_0"),
            (str_store_faction_name, s1, "$g_multiplayer_poll_value_2_to_show"),
            (str_store_faction_name, s2, "$g_multiplayer_poll_value_3_to_show"),
            (create_text_overlay, reg0, "str_poll_change_map_with_faction", 131088),
        (else_try),
            (assign, reg0, "$g_multiplayer_poll_value_to_show"),
            (assign, reg1, "$g_multiplayer_poll_value_2_to_show"),
            (str_store_faction_name, s0, "$g_multiplayer_team_1_faction"),
            (str_store_faction_name, s1, "$g_multiplayer_team_2_faction"),
            (create_text_overlay, reg0, "str_poll_change_number_of_bots", 131088),
        (try_end),
        (overlay_set_color, reg0, 16777215),
        (try_begin),
            (neg|eq, "$g_multiplayer_poll_to_show", 3),
            (neg|eq, "$g_multiplayer_poll_to_show", 4),
            (position_set_x, pos1, 400),
            (position_set_y, pos1, 100),
            (overlay_set_position, reg0, pos1),
        (else_try),
            (position_set_x, pos1, 50),
            (position_set_y, pos1, 70),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 750),
            (position_set_y, pos1, 60),
            (overlay_set_area_size, reg0, pos1),
        (try_end),
        (store_mission_timer_a, ":var_1"),
        (store_sub, "$g_multiplayer_poll_last_written_seconds_left", "$g_multiplayer_poll_client_end_time", ":var_1"),
        (assign, reg0, "$g_multiplayer_poll_last_written_seconds_left"),
        (create_text_overlay, "$g_presentation_obj_poll_1", "str_poll_time_left", 32776),
        (overlay_set_color, "$g_presentation_obj_poll_1", 16777215),
        (position_set_x, pos1, 790),
        (position_set_y, pos1, 60),
        (overlay_set_position, "$g_presentation_obj_poll_1", pos1),
        (omit_key_once, key_1),
        (omit_key_once, key_2),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_run, [
        (store_trigger_param_1, ":var_0"),
        (try_begin),
            (this_or_next|key_clicked, key_escape),
            (key_clicked, key_2),
            (gt, ":var_0", 500),
            (multiplayer_send_int_to_server, 22, 0),
            (clear_omitted_keys),
            (presentation_set_duration, 0),
        (else_try),
            (key_clicked, key_1),
            (gt, ":var_0", 500),
            (multiplayer_send_int_to_server, 22, 1),
            (clear_omitted_keys),
            (presentation_set_duration, 0),
        (try_end),
        (store_mission_timer_a, ":var_1"),
        (store_sub, ":var_2", "$g_multiplayer_poll_client_end_time", ":var_1"),
        (try_begin),
            (neg|eq, ":var_2", "$g_multiplayer_poll_last_written_seconds_left"),
            (try_begin),
                (neg|ge, ":var_2", 0),
                (clear_omitted_keys),
                (presentation_set_duration, 0),
            (else_try),
                (assign, "$g_multiplayer_poll_last_written_seconds_left", ":var_2"),
                (assign, reg0, "$g_multiplayer_poll_last_written_seconds_left"),
                (overlay_set_text, "$g_presentation_obj_poll_1", "str_poll_time_left"),
            (try_end),
        (try_end),
    ]),
]),

("tutorial_show_mouse_movement", prsntf_manual_end_only|prsntf_read_only, 0, [
    (ti_on_presentation_load, [
        (try_begin),
            (this_or_next|eq, "$g_tutorial_mouse_dir", -1),
            (eq, "$g_tutorial_mouse_click", -1),
            (presentation_set_duration, 0),
        (else_try),
            (set_fixed_point_multiplier, 1000),
            (assign, "$g_tutorial_displayed_mouse_dir", "$g_tutorial_mouse_dir"),
            (assign, "$g_tutorial_displayed_mouse_click", "$g_tutorial_mouse_click"),
            (store_add, ":var_0", "$g_tutorial_mouse_dir", "mesh_mouse_arrow_down"),
            (create_mesh_overlay, reg0, ":var_0"),
            (position_set_x, pos1, 800),
            (position_set_y, pos1, 800),
            (overlay_set_size, reg0, pos1),
            (position_set_x, pos1, 380),
            (position_set_y, pos1, 500),
            (overlay_set_position, reg0, pos1),
            (try_begin),
                (eq, "$g_tutorial_mouse_click", 0),
                (create_mesh_overlay, reg0, "mesh_mouse_left_click"),
            (else_try),
                (create_mesh_overlay, reg0, "mesh_mouse_right_click"),
            (try_end),
            (position_set_x, pos1, 800),
            (position_set_y, pos1, 800),
            (overlay_set_size, reg0, pos1),
            (position_set_x, pos1, 540),
            (position_set_y, pos1, 500),
            (overlay_set_position, reg0, pos1),
            (create_mesh_overlay, reg0, "mesh_mouse_arrow_plus"),
            (overlay_set_color, reg0, 16777215),
            (position_set_x, pos1, 600),
            (position_set_y, pos1, 600),
            (overlay_set_size, reg0, pos1),
            (position_set_x, pos1, 470),
            (position_set_y, pos1, 510),
            (overlay_set_position, reg0, pos1),
            (presentation_set_duration, 999999),
        (try_end),
    ]),
    (ti_on_presentation_run, [
        (try_begin),
            (this_or_next|neg|eq, "$g_tutorial_displayed_mouse_dir", "$g_tutorial_mouse_dir"),
            (neg|eq, "$g_tutorial_displayed_mouse_click", "$g_tutorial_mouse_click"),
            (presentation_set_duration, 0),
            (try_begin),
                (ge, "$g_tutorial_mouse_dir", 0),
                (ge, "$g_tutorial_mouse_click", 0),
                (start_presentation, "prsnt_tutorial_show_mouse_movement"),
            (try_end),
        (try_end),
    ]),
]),

("name_party", 0, mesh_load_window, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (str_store_string, s1, "@What will be the name of your party?"),
        (create_text_overlay, reg1, 1, 16),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 500),
        (overlay_set_position, reg1, pos1),
        (overlay_set_text, reg1, 1),
        (create_simple_text_box_overlay, "$g_presentation_obj_name_kingdom_1"),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 400),
        (overlay_set_position, "$g_presentation_obj_name_kingdom_1", pos1),
        (str_store_party_name, s7, "p_main_party"),
        (overlay_set_text, "$g_presentation_obj_name_kingdom_1", 7),
        (create_button_overlay, "$g_presentation_obj_name_kingdom_2", "@Continue...", 16),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 300),
        (overlay_set_position, "$g_presentation_obj_name_kingdom_2", pos1),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":var_0"),
        (try_begin),
            (eq, ":var_0", "$g_presentation_obj_name_kingdom_1"),
            (str_store_string, s7, 0),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_name_kingdom_2"),
            (party_set_name, "p_main_party", 7),
            (presentation_set_duration, 0),
        (try_end),
    ]),
]),

("name_stronghold", 0, mesh_load_window, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (str_store_string, s1, "@What shall be the new name of the Order stronghold?"),
        (create_text_overlay, reg1, 1, 16),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 500),
        (overlay_set_position, reg1, pos1),
        (overlay_set_text, reg1, 1),
        (create_simple_text_box_overlay, "$g_presentation_obj_name_kingdom_1"),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 400),
        (overlay_set_position, "$g_presentation_obj_name_kingdom_1", pos1),
        (str_store_party_name, s7, "p_snake_stronghold"),
        (overlay_set_text, "$g_presentation_obj_name_kingdom_1", 7),
        (create_button_overlay, "$g_presentation_obj_name_kingdom_2", "@Continue...", 16),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 300),
        (overlay_set_position, "$g_presentation_obj_name_kingdom_2", pos1),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":var_0"),
        (try_begin),
            (eq, ":var_0", "$g_presentation_obj_name_kingdom_1"),
            (str_store_string, s7, 0),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_name_kingdom_2"),
            (party_set_name, "p_snake_stronghold", 7),
            (presentation_set_duration, 0),
        (try_end),
    ]),
]),

("name_kingdom", 0, mesh_load_window, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (str_store_string, s1, "str_name_kingdom_text"),
        (create_text_overlay, reg1, 1, 16),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 500),
        (overlay_set_position, reg1, pos1),
        (overlay_set_text, reg1, 1),
        (create_simple_text_box_overlay, "$g_presentation_obj_name_kingdom_1"),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 400),
        (overlay_set_position, "$g_presentation_obj_name_kingdom_1", pos1),
        (try_begin),
            (eq, "$players_kingdom_name_set", 1),
            (str_store_faction_name, s7, "fac_player_supporters_faction"),
            (overlay_set_text, "$g_presentation_obj_name_kingdom_1", 7),
        (else_try),
            (str_store_troop_name, s0, "trp_player"),
            (overlay_set_text, "$g_presentation_obj_name_kingdom_1", "str_default_kingdom_name"),
            (str_store_string, s7, "str_default_kingdom_name"),
        (try_end),
        (create_button_overlay, "$g_presentation_obj_name_kingdom_2", "@Continue...", 16),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 300),
        (overlay_set_position, "$g_presentation_obj_name_kingdom_2", pos1),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":var_0"),
        (try_begin),
            (eq, ":var_0", "$g_presentation_obj_name_kingdom_1"),
            (str_store_string, s7, 0),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_name_kingdom_2"),
            (faction_set_name, "fac_player_supporters_faction", 7),
            (faction_set_color, "fac_player_supporters_faction", 3200456),
            (assign, "$players_kingdom_name_set", 1),
            (presentation_set_duration, 0),
        (try_end),
    ]),
]),

("name_order", 0, mesh_load_window, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (str_store_string, s1, "@What shall be the name of your Order?"),
        (create_text_overlay, reg1, 1, 16),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 550),
        (overlay_set_position, reg1, pos1),
        (overlay_set_text, reg1, 1),
        (str_store_string, s1, "@Order of the"),
        (create_text_overlay, reg1, 1, 16),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 500),
        (overlay_set_position, reg1, pos1),
        (overlay_set_text, reg1, 1),
        (create_simple_text_box_overlay, "$g_presentation_obj_name_kingdom_1"),
        (position_set_x, pos1, 470),
        (position_set_y, pos1, 500),
        (overlay_set_position, "$g_presentation_obj_name_kingdom_1", pos1),
        (try_begin),
            (eq, "$players_order_name_set", 1),
            (str_store_faction_name, s7, "fac_player_knights"),
            (overlay_set_text, "$g_presentation_obj_name_kingdom_1", 7),
        (else_try),
            (str_store_troop_name, s0, "trp_player"),
            (overlay_set_text, "$g_presentation_obj_name_kingdom_1", "@Knights of {s0}"),
            (str_store_string, s7, "@Knights of {s0}"),
        (try_end),
        (str_store_string, s1, "@What shall be called your Order Knight (singular and plural)?"),
        (create_text_overlay, reg1, 1, 16),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 450),
        (overlay_set_position, reg1, pos1),
        (overlay_set_text, reg1, 1),
        (create_simple_text_box_overlay, "$g_presentation_obj_name_order_knight"),
        (position_set_x, pos1, 250),
        (position_set_y, pos1, 400),
        (overlay_set_position, "$g_presentation_obj_name_order_knight", pos1),
        (str_store_troop_name, s8, "trp_player_knight"),
        (overlay_set_text, "$g_presentation_obj_name_order_knight", 8),
        (create_simple_text_box_overlay, "$g_presentation_obj_name_order_knight_plural"),
        (position_set_x, pos1, 550),
        (position_set_y, pos1, 400),
        (overlay_set_position, "$g_presentation_obj_name_order_knight_plural", pos1),
        (str_store_troop_name_plural, s10, "trp_player_knight"),
        (overlay_set_text, "$g_presentation_obj_name_order_knight_plural", 10),
        (str_store_string, s1, "@What shall be called your Order Sergeant (singular and plural)?"),
        (create_text_overlay, reg1, 1, 16),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 350),
        (overlay_set_position, reg1, pos1),
        (overlay_set_text, reg1, 1),
        (create_simple_text_box_overlay, "$g_presentation_obj_name_order_squire"),
        (position_set_x, pos1, 250),
        (position_set_y, pos1, 300),
        (overlay_set_position, "$g_presentation_obj_name_order_squire", pos1),
        (str_store_troop_name, s9, "trp_player_sergeant"),
        (overlay_set_text, "$g_presentation_obj_name_order_squire", 9),
        (create_simple_text_box_overlay, "$g_presentation_obj_name_order_squire_plural"),
        (position_set_x, pos1, 550),
        (position_set_y, pos1, 300),
        (overlay_set_position, "$g_presentation_obj_name_order_squire_plural", pos1),
        (str_store_troop_name_plural, s11, "trp_player_sergeant"),
        (overlay_set_text, "$g_presentation_obj_name_order_squire_plural", 11),
        (create_button_overlay, "$g_presentation_obj_name_kingdom_2", "@Continue...", 16),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 200),
        (overlay_set_position, "$g_presentation_obj_name_kingdom_2", pos1),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":var_0"),
        (try_begin),
            (eq, ":var_0", "$g_presentation_obj_name_kingdom_1"),
            (str_store_string, s7, 0),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_name_order_knight"),
            (str_store_string, s8, 0),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_name_order_knight_plural"),
            (str_store_string, s10, 0),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_name_order_squire"),
            (str_store_string, s9, 0),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_name_order_squire_plural"),
            (str_store_string, s11, 0),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_name_kingdom_2"),
            (faction_set_name, "fac_player_knights", 7),
            (troop_set_name, "trp_player_knight", 8),
            (troop_set_name, "trp_player_knight_save", 8),
            (troop_set_plural_name, "trp_player_knight", 10),
            (troop_set_plural_name, "trp_player_knight_save", 10),
            (troop_set_name, "trp_player_sergeant", 9),
            (troop_set_name, "trp_player_sergeant_save", 9),
            (troop_set_plural_name, "trp_player_sergeant", 11),
            (troop_set_plural_name, "trp_player_sergeant_save", 11),
            (assign, "$players_order_name_set", 1),
            (faction_get_color, ":var_1", "$players_kingdom"),
            (call_script, "script_randomize_color", ":var_1"),
            (faction_set_color, "fac_player_knights", reg0),
            (try_begin),
                (faction_slot_eq, "$players_kingdom", slot_faction_culture, "fac_culture_4"),
                (troop_set_type, "trp_player_knight", 2),
                (troop_set_type, "trp_player_knight_dummy", 2),
                (troop_set_type, "trp_player_knight_save", 2),
                (troop_set_type, "trp_player_knight_before_training", 2),
            (else_try),
                (troop_set_type, "trp_player_knight", 0),
                (troop_set_type, "trp_player_knight_dummy", 0),
                (troop_set_type, "trp_player_knight_save", 0),
                (troop_set_type, "trp_player_knight_before_training", 0),
            (try_end),
            (presentation_set_duration, 0),
        (try_end),
    ]),
]),

("banner_selection", 0, mesh_load_window, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (str_store_string, s1, "str_banner_selection_text"),
        (create_text_overlay, reg1, 1, 16),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 600),
        (overlay_set_position, reg1, pos1),
        (overlay_set_text, reg1, 1),
        (create_button_overlay, "$g_presentation_obj_banner_selection_1", "@Next Page", 16),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 50),
        (overlay_set_position, "$g_presentation_obj_banner_selection_1", pos1),
        (assign, ":var_0", 150),
        (assign, ":var_1", 575),
        (assign, ":var_2", "mesh_banner_f21"),
        (assign, ":var_3", 6),
        (val_sub, ":var_2", ":var_3"),
        (store_mul, ":var_4", 16, "$g_presentation_page_no"),
        (val_add, ":var_4", "mesh_banner_a01"),
        (store_add, ":var_5", ":var_4", 16),
        (val_min, ":var_2", ":var_5"),
        (store_add, "$g_presentation_banner_start", "$g_presentation_obj_banner_selection_1", 1),
        (try_for_range, ":var_6", ":var_4", ":var_2"),
            (create_image_button_overlay, reg1, ":var_6", ":var_6"),
            (position_set_x, pos1, ":var_0"),
            (position_set_y, pos1, ":var_1"),
            (overlay_set_position, reg1, pos1),
            (position_set_x, pos1, 100),
            (position_set_y, pos1, 100),
            (overlay_set_size, reg1, pos1),
            (val_add, ":var_0", 100),
            (ge, ":var_0", 900),
            (assign, ":var_0", 150),
            (val_sub, ":var_1", 250),
        (try_end),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":var_0"),
        (try_begin),
            (eq, ":var_0", "$g_presentation_obj_banner_selection_1"),
            (val_add, "$g_presentation_page_no", 1),
            (val_mod, "$g_presentation_page_no", 8),
            (start_presentation, "prsnt_banner_selection"),
        (else_try),
            (store_sub, ":var_1", ":var_0", "$g_presentation_banner_start"),
            (store_mul, ":var_2", 16, "$g_presentation_page_no"),
            (val_add, ":var_1", ":var_2"),
            (store_add, ":var_3", ":var_1", "icon_banner_01"),
            (party_set_banner_icon, "p_main_party", ":var_3"),
            (store_add, ":var_4", ":var_1", "spr_banner_a"),
            (troop_set_slot, "trp_player", slot_troop_banner_scene_prop, ":var_4"),
            (presentation_set_duration, 0),
            (assign, ":var_5", 0),
            (assign, ":var_6", "trp_knight_1_1_wife"),
            (try_for_range, ":var_7", "trp_npc_adonja", ":var_6"),
                (troop_slot_eq, ":var_7", slot_troop_banner_scene_prop, ":var_4"),
                (assign, ":var_5", ":var_7"),
                (assign, ":var_6", 0),
                (troop_set_slot, ":var_7", slot_troop_banner_scene_prop, "spr_banner_f21"),
                (troop_get_slot, ":var_8", ":var_7", slot_troop_leaded_party),
                (gt, ":var_8", 0),
                (party_set_banner_icon, ":var_8", "icon_banner_136"),
            (try_end),
            (try_for_range, ":var_9", "p_town_1", "p_salt_mine"),
                (try_begin),
                    (party_slot_eq, ":var_9", slot_town_lord, "trp_player"),
                    (party_set_banner_icon, ":var_9", ":var_3"),
                (else_try),
                    (party_slot_eq, ":var_9", slot_town_lord, ":var_5"),
                    (party_set_banner_icon, ":var_9", "icon_banner_136"),
                (try_end),
            (try_end),
        (try_end),
    ]),
    (ti_on_presentation_run, [
        (try_begin),
            (this_or_next|key_clicked, key_space),
            (this_or_next|key_clicked, key_enter),
            (this_or_next|key_clicked, key_escape),
            (key_clicked, key_back_space),
            (presentation_set_duration, 0),
        (try_end),
    ]),
]),

("custom_banner", 0, mesh_load_window, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (troop_get_slot, ":var_0", "trp_player", slot_troop_custom_banner_flag_type),
        (val_max, ":var_0", 0),
        (val_add, ":var_0", "mesh_custom_banner_01"),
        (troop_get_slot, ":var_1", "trp_player", slot_troop_custom_banner_map_flag_type),
        (val_max, ":var_1", 0),
        (val_add, ":var_1", "mesh_custom_map_banner_01"),
        (troop_get_slot, ":var_2", "trp_player", slot_troop_custom_banner_bg_color_1),
        (troop_get_slot, ":var_3", "trp_player", slot_troop_custom_banner_bg_color_2),
        (create_text_overlay, reg1, "str_color_no_1", 0),
        (position_set_x, pos1, 40),
        (position_set_y, pos1, 550),
        (overlay_set_position, reg1, pos1),
        (create_text_overlay, reg1, "str_color_no_2", 0),
        (position_set_x, pos1, 40),
        (position_set_y, pos1, 500),
        (overlay_set_position, reg1, pos1),
        (create_image_button_overlay_with_tableau_material, "$g_presentation_obj_custom_banner_22", "mesh_color_picker", "tableau_color_picker", ":var_2"),
        (create_image_button_overlay_with_tableau_material, "$g_presentation_obj_custom_banner_23", "mesh_color_picker", "tableau_color_picker", ":var_3"),
        (position_set_x, pos1, 200),
        (position_set_y, pos1, 565),
        (overlay_set_position, "$g_presentation_obj_custom_banner_22", pos1),
        (position_set_y, pos1, 515),
        (overlay_set_position, "$g_presentation_obj_custom_banner_23", pos1),
        (position_set_x, pos1, 250),
        (position_set_y, pos1, 250),
        (overlay_set_size, "$g_presentation_obj_custom_banner_22", pos1),
        (overlay_set_size, "$g_presentation_obj_custom_banner_23", pos1),
        (create_button_overlay, "$g_presentation_obj_custom_banner_2", "str_change", 16),
        (create_button_overlay, "$g_presentation_obj_custom_banner_3", "str_change", 16),
        (create_button_overlay, "$g_presentation_obj_custom_banner_4", "str_change_background", 16),
        (create_button_overlay, "$g_presentation_obj_custom_banner_5", "str_change", 16),
        (create_button_overlay, "$g_presentation_obj_custom_banner_19", "str_change", 16),
        (create_button_overlay, "$g_presentation_obj_custom_banner_20", "str_accept", 16),
        (troop_get_slot, ":var_4", "trp_player", slot_troop_custom_banner_num_charges),
        (create_button_overlay, "$g_presentation_obj_custom_banner_16", "str_randomize", 16),
        (create_image_button_overlay_with_tableau_material, "$g_presentation_obj_custom_banner_17", ":var_0", "tableau_custom_banner_default", "trp_player"),
        (try_begin),
            (eq, ":var_1", "mesh_custom_map_banner_01"),
            (create_image_button_overlay_with_tableau_material, "$g_presentation_obj_custom_banner_18", ":var_1", "tableau_custom_banner_square", "trp_player"),
        (else_try),
            (eq, ":var_1", "mesh_custom_map_banner_02"),
            (create_image_button_overlay_with_tableau_material, "$g_presentation_obj_custom_banner_18", ":var_1", "tableau_custom_banner_short", "trp_player"),
        (else_try),
            (create_image_button_overlay_with_tableau_material, "$g_presentation_obj_custom_banner_18", ":var_1", "tableau_custom_banner_tall", "trp_player"),
        (try_end),
        (create_image_button_overlay_with_tableau_material, "$g_presentation_obj_custom_banner_1", -1, "tableau_custom_banner_square_no_mesh", "trp_player"),
        (create_text_overlay, reg1, "str_sample_banner", 16),
        (position_set_x, pos1, 825),
        (position_set_y, pos1, 650),
        (overlay_set_position, reg1, pos1),
        (create_text_overlay, reg1, "str_sample_map_banner", 16),
        (position_set_y, pos1, 500),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 640),
        (overlay_set_position, "$g_presentation_obj_custom_banner_17", pos1),
        (position_set_x, pos1, 780),
        (position_set_y, pos1, 315),
        (overlay_set_position, "$g_presentation_obj_custom_banner_18", pos1),
        (position_set_x, pos1, 50),
        (position_set_y, pos1, 50),
        (overlay_set_size, "$g_presentation_obj_custom_banner_17", pos1),
        (position_set_x, pos1, 50),
        (position_set_y, pos1, 50),
        (overlay_set_size, "$g_presentation_obj_custom_banner_18", pos1),
        (create_text_overlay, reg1, "str_number_of_charges", 0),
        (position_set_x, pos1, 40),
        (position_set_y, pos1, 350),
        (overlay_set_position, reg1, pos1),
        (assign, reg1, ":var_4"),
        (create_text_overlay, reg2, "str_reg1", 16),
        (position_set_x, pos1, 350),
        (position_set_y, pos1, 350),
        (overlay_set_position, reg2, pos1),
        (try_begin),
            (neg|ge, ":var_4", 4),
            (create_button_overlay, "$g_presentation_obj_custom_banner_15", "str_plus", 16),
            (position_set_x, pos1, 385),
            (position_set_y, pos1, 350),
            (overlay_set_position, "$g_presentation_obj_custom_banner_15", pos1),
        (else_try),
            (assign, "$g_presentation_obj_custom_banner_15", -1),
        (try_end),
        (try_begin),
            (gt, ":var_4", 0),
            (create_button_overlay, "$g_presentation_obj_custom_banner_21", "str_minus", 16),
            (position_set_x, pos1, 370),
            (position_set_y, pos1, 350),
            (overlay_set_position, "$g_presentation_obj_custom_banner_21", pos1),
        (else_try),
            (assign, "$g_presentation_obj_custom_banner_21", -1),
        (try_end),
        (try_begin),
            (ge, ":var_4", 1),
            (create_text_overlay, reg1, "str_charge", 16),
            (position_set_x, pos1, 300),
            (position_set_y, pos1, 300),
            (overlay_set_position, reg1, pos1),
            (create_text_overlay, reg1, "str_color", 16),
            (position_set_x, pos1, 550),
            (position_set_y, pos1, 300),
            (overlay_set_position, reg1, pos1),
            (create_button_overlay, "$g_presentation_obj_custom_banner_14", "str_change_charge_position", 16),
            (position_set_y, pos1, 350),
            (position_set_x, pos1, 550),
            (overlay_set_position, "$g_presentation_obj_custom_banner_14", pos1),
            (create_text_overlay, reg1, "str_charge_no_1", 0),
            (position_set_x, pos1, 40),
            (position_set_y, pos1, 240),
            (overlay_set_position, reg1, pos1),
            (create_button_overlay, "$g_presentation_obj_custom_banner_6", "str_change", 0),
            (position_set_x, pos1, 310),
            (overlay_set_position, "$g_presentation_obj_custom_banner_6", pos1),
            (create_button_overlay, "$g_presentation_obj_custom_banner_7", "str_change", 0),
            (position_set_x, pos1, 560),
            (overlay_set_position, "$g_presentation_obj_custom_banner_7", pos1),
            (troop_get_slot, ":var_5", "trp_player", slot_troop_custom_banner_charge_type_1),
            (val_mod, ":var_5", 256),
            (val_add, ":var_5", "mesh_custom_banner_charge_01"),
            (create_image_button_overlay, "$g_presentation_obj_custom_banner_24", ":var_5", ":var_5"),
            (position_set_x, pos1, 260),
            (position_set_y, pos1, 255),
            (overlay_set_position, "$g_presentation_obj_custom_banner_24", pos1),
            (position_set_x, pos1, 50),
            (position_set_y, pos1, 50),
            (overlay_set_size, "$g_presentation_obj_custom_banner_24", pos1),
            (troop_get_slot, ":var_6", "trp_player", slot_troop_custom_banner_charge_color_1),
            (create_image_button_overlay_with_tableau_material, "$g_presentation_obj_custom_banner_28", "mesh_color_picker", "tableau_color_picker", ":var_6"),
            (position_set_x, pos1, 530),
            (position_set_y, pos1, 255),
            (overlay_set_position, "$g_presentation_obj_custom_banner_28", pos1),
            (position_set_x, pos1, 250),
            (position_set_y, pos1, 250),
            (overlay_set_size, "$g_presentation_obj_custom_banner_28", pos1),
            (create_button_overlay, "$g_presentation_obj_custom_banner_32", "str_flip_horizontal", 0),
            (position_set_x, pos1, 700),
            (position_set_y, pos1, 240),
            (overlay_set_position, "$g_presentation_obj_custom_banner_32", pos1),
            (create_button_overlay, "$g_presentation_obj_custom_banner_33", "str_flip_vertical", 0),
            (position_set_x, pos1, 800),
            (overlay_set_position, "$g_presentation_obj_custom_banner_33", pos1),
        (try_end),
        (try_begin),
            (ge, ":var_4", 2),
            (create_text_overlay, reg1, "str_charge_no_2", 0),
            (position_set_x, pos1, 40),
            (position_set_y, pos1, 180),
            (overlay_set_position, reg1, pos1),
            (create_button_overlay, "$g_presentation_obj_custom_banner_8", "str_change", 0),
            (position_set_x, pos1, 310),
            (overlay_set_position, "$g_presentation_obj_custom_banner_8", pos1),
            (create_button_overlay, "$g_presentation_obj_custom_banner_9", "str_change", 0),
            (position_set_x, pos1, 560),
            (overlay_set_position, "$g_presentation_obj_custom_banner_9", pos1),
            (troop_get_slot, ":var_5", "trp_player", slot_troop_custom_banner_charge_type_2),
            (val_mod, ":var_5", 256),
            (val_add, ":var_5", "mesh_custom_banner_charge_01"),
            (create_image_button_overlay, "$g_presentation_obj_custom_banner_25", ":var_5", ":var_5"),
            (position_set_x, pos1, 260),
            (position_set_y, pos1, 195),
            (overlay_set_position, "$g_presentation_obj_custom_banner_25", pos1),
            (position_set_x, pos1, 50),
            (position_set_y, pos1, 50),
            (overlay_set_size, "$g_presentation_obj_custom_banner_25", pos1),
            (troop_get_slot, ":var_6", "trp_player", slot_troop_custom_banner_charge_color_2),
            (create_image_button_overlay_with_tableau_material, "$g_presentation_obj_custom_banner_29", "mesh_color_picker", "tableau_color_picker", ":var_6"),
            (position_set_x, pos1, 530),
            (position_set_y, pos1, 195),
            (overlay_set_position, "$g_presentation_obj_custom_banner_29", pos1),
            (position_set_x, pos1, 250),
            (position_set_y, pos1, 250),
            (overlay_set_size, "$g_presentation_obj_custom_banner_29", pos1),
            (create_button_overlay, "$g_presentation_obj_custom_banner_34", "str_flip_horizontal", 0),
            (position_set_x, pos1, 700),
            (position_set_y, pos1, 180),
            (overlay_set_position, "$g_presentation_obj_custom_banner_34", pos1),
            (create_button_overlay, "$g_presentation_obj_custom_banner_35", "str_flip_vertical", 0),
            (position_set_x, pos1, 800),
            (overlay_set_position, "$g_presentation_obj_custom_banner_35", pos1),
        (try_end),
        (try_begin),
            (ge, ":var_4", 3),
            (create_text_overlay, reg1, "str_charge_no_3", 0),
            (position_set_x, pos1, 40),
            (position_set_y, pos1, 120),
            (overlay_set_position, reg1, pos1),
            (create_button_overlay, "$g_presentation_obj_custom_banner_10", "str_change", 0),
            (position_set_x, pos1, 310),
            (overlay_set_position, "$g_presentation_obj_custom_banner_10", pos1),
            (create_button_overlay, "$g_presentation_obj_custom_banner_11", "str_change", 0),
            (position_set_x, pos1, 560),
            (overlay_set_position, "$g_presentation_obj_custom_banner_11", pos1),
            (troop_get_slot, ":var_5", "trp_player", slot_troop_custom_banner_charge_type_3),
            (val_mod, ":var_5", 256),
            (val_add, ":var_5", "mesh_custom_banner_charge_01"),
            (create_image_button_overlay, "$g_presentation_obj_custom_banner_26", ":var_5", ":var_5"),
            (position_set_x, pos1, 260),
            (position_set_y, pos1, 135),
            (overlay_set_position, "$g_presentation_obj_custom_banner_26", pos1),
            (position_set_x, pos1, 50),
            (position_set_y, pos1, 50),
            (overlay_set_size, "$g_presentation_obj_custom_banner_26", pos1),
            (troop_get_slot, ":var_6", "trp_player", slot_troop_custom_banner_charge_color_3),
            (create_image_button_overlay_with_tableau_material, "$g_presentation_obj_custom_banner_30", "mesh_color_picker", "tableau_color_picker", ":var_6"),
            (position_set_x, pos1, 530),
            (position_set_y, pos1, 135),
            (overlay_set_position, "$g_presentation_obj_custom_banner_30", pos1),
            (position_set_x, pos1, 250),
            (position_set_y, pos1, 250),
            (overlay_set_size, "$g_presentation_obj_custom_banner_30", pos1),
            (create_button_overlay, "$g_presentation_obj_custom_banner_36", "str_flip_horizontal", 0),
            (position_set_x, pos1, 700),
            (position_set_y, pos1, 120),
            (overlay_set_position, "$g_presentation_obj_custom_banner_36", pos1),
            (create_button_overlay, "$g_presentation_obj_custom_banner_37", "str_flip_vertical", 0),
            (position_set_x, pos1, 800),
            (overlay_set_position, "$g_presentation_obj_custom_banner_37", pos1),
        (try_end),
        (try_begin),
            (ge, ":var_4", 4),
            (create_text_overlay, reg1, "str_charge_no_4", 0),
            (position_set_x, pos1, 40),
            (position_set_y, pos1, 60),
            (overlay_set_position, reg1, pos1),
            (create_button_overlay, "$g_presentation_obj_custom_banner_12", "str_change", 0),
            (position_set_x, pos1, 310),
            (overlay_set_position, "$g_presentation_obj_custom_banner_12", pos1),
            (create_button_overlay, "$g_presentation_obj_custom_banner_13", "str_change", 0),
            (position_set_x, pos1, 560),
            (overlay_set_position, "$g_presentation_obj_custom_banner_13", pos1),
            (troop_get_slot, ":var_5", "trp_player", slot_troop_custom_banner_charge_type_4),
            (val_mod, ":var_5", 256),
            (val_add, ":var_5", "mesh_custom_banner_charge_01"),
            (create_image_button_overlay, "$g_presentation_obj_custom_banner_27", ":var_5", ":var_5"),
            (position_set_x, pos1, 260),
            (position_set_y, pos1, 75),
            (overlay_set_position, "$g_presentation_obj_custom_banner_27", pos1),
            (position_set_x, pos1, 50),
            (position_set_y, pos1, 50),
            (overlay_set_size, "$g_presentation_obj_custom_banner_27", pos1),
            (troop_get_slot, ":var_6", "trp_player", slot_troop_custom_banner_charge_color_4),
            (create_image_button_overlay_with_tableau_material, "$g_presentation_obj_custom_banner_31", "mesh_color_picker", "tableau_color_picker", ":var_6"),
            (position_set_x, pos1, 530),
            (position_set_y, pos1, 75),
            (overlay_set_position, "$g_presentation_obj_custom_banner_31", pos1),
            (position_set_x, pos1, 250),
            (position_set_y, pos1, 250),
            (overlay_set_size, "$g_presentation_obj_custom_banner_31", pos1),
            (create_button_overlay, "$g_presentation_obj_custom_banner_38", "str_flip_horizontal", 0),
            (position_set_x, pos1, 700),
            (position_set_y, pos1, 60),
            (overlay_set_position, "$g_presentation_obj_custom_banner_38", pos1),
            (create_button_overlay, "$g_presentation_obj_custom_banner_39", "str_flip_vertical", 0),
            (position_set_x, pos1, 800),
            (overlay_set_position, "$g_presentation_obj_custom_banner_39", pos1),
        (try_end),
        (position_set_x, pos1, 350),
        (position_set_y, pos1, 400),
        (overlay_set_position, "$g_presentation_obj_custom_banner_1", pos1),
        (position_set_x, pos1, 275),
        (position_set_y, pos1, 550),
        (overlay_set_position, "$g_presentation_obj_custom_banner_2", pos1),
        (position_set_y, pos1, 500),
        (overlay_set_position, "$g_presentation_obj_custom_banner_3", pos1),
        (position_set_x, pos1, 175),
        (position_set_y, pos1, 600),
        (overlay_set_position, "$g_presentation_obj_custom_banner_4", pos1),
        (position_set_x, pos1, 880),
        (position_set_y, pos1, 575),
        (overlay_set_position, "$g_presentation_obj_custom_banner_5", pos1),
        (position_set_y, pos1, 400),
        (overlay_set_position, "$g_presentation_obj_custom_banner_19", pos1),
        (position_set_y, pos1, 650),
        (position_set_x, pos1, 175),
        (overlay_set_position, "$g_presentation_obj_custom_banner_16", pos1),
        (position_set_y, pos1, 150),
        (position_set_x, pos1, 850),
        (overlay_set_position, "$g_presentation_obj_custom_banner_20", pos1),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":var_0"),
        (troop_get_slot, ":var_1", "trp_player", slot_troop_custom_banner_num_charges),
        (try_begin),
            (this_or_next|eq, ":var_0", "$g_presentation_obj_custom_banner_2"),
            (eq, ":var_0", "$g_presentation_obj_custom_banner_22"),
            (assign, "$g_presentation_next_presentation", "prsnt_custom_banner"),
            (assign, "$g_presentation_output_slot", 85),
            (start_presentation, "prsnt_color_selection"),
        (else_try),
            (this_or_next|eq, ":var_0", "$g_presentation_obj_custom_banner_3"),
            (eq, ":var_0", "$g_presentation_obj_custom_banner_23"),
            (assign, "$g_presentation_next_presentation", "prsnt_custom_banner"),
            (assign, "$g_presentation_output_slot", 86),
            (start_presentation, "prsnt_color_selection"),
        (else_try),
            (this_or_next|eq, ":var_0", "$g_presentation_obj_custom_banner_4"),
            (eq, ":var_0", "$g_presentation_obj_custom_banner_1"),
            (assign, "$g_presentation_next_presentation", "prsnt_custom_banner"),
            (start_presentation, "prsnt_banner_background_selection"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_custom_banner_5"),
            (assign, "$g_presentation_next_presentation", "prsnt_custom_banner"),
            (start_presentation, "prsnt_banner_flag_type_selection"),
        (else_try),
            (ge, ":var_1", 1),
            (this_or_next|eq, ":var_0", "$g_presentation_obj_custom_banner_6"),
            (eq, ":var_0", "$g_presentation_obj_custom_banner_24"),
            (assign, "$g_presentation_next_presentation", "prsnt_custom_banner"),
            (assign, "$g_presentation_output_slot", 92),
            (start_presentation, "prsnt_banner_charge_selection"),
        (else_try),
            (ge, ":var_1", 1),
            (this_or_next|eq, ":var_0", "$g_presentation_obj_custom_banner_7"),
            (eq, ":var_0", "$g_presentation_obj_custom_banner_28"),
            (assign, "$g_presentation_next_presentation", "prsnt_custom_banner"),
            (assign, "$g_presentation_output_slot", 87),
            (start_presentation, "prsnt_color_selection"),
        (else_try),
            (ge, ":var_1", 2),
            (this_or_next|eq, ":var_0", "$g_presentation_obj_custom_banner_8"),
            (eq, ":var_0", "$g_presentation_obj_custom_banner_25"),
            (assign, "$g_presentation_next_presentation", "prsnt_custom_banner"),
            (assign, "$g_presentation_output_slot", 93),
            (start_presentation, "prsnt_banner_charge_selection"),
        (else_try),
            (ge, ":var_1", 2),
            (this_or_next|eq, ":var_0", "$g_presentation_obj_custom_banner_9"),
            (eq, ":var_0", "$g_presentation_obj_custom_banner_29"),
            (assign, "$g_presentation_next_presentation", "prsnt_custom_banner"),
            (assign, "$g_presentation_output_slot", 88),
            (start_presentation, "prsnt_color_selection"),
        (else_try),
            (ge, ":var_1", 3),
            (this_or_next|eq, ":var_0", "$g_presentation_obj_custom_banner_10"),
            (eq, ":var_0", "$g_presentation_obj_custom_banner_26"),
            (assign, "$g_presentation_next_presentation", "prsnt_custom_banner"),
            (assign, "$g_presentation_output_slot", 94),
            (start_presentation, "prsnt_banner_charge_selection"),
        (else_try),
            (ge, ":var_1", 3),
            (this_or_next|eq, ":var_0", "$g_presentation_obj_custom_banner_11"),
            (eq, ":var_0", "$g_presentation_obj_custom_banner_30"),
            (assign, "$g_presentation_next_presentation", "prsnt_custom_banner"),
            (assign, "$g_presentation_output_slot", 89),
            (start_presentation, "prsnt_color_selection"),
        (else_try),
            (ge, ":var_1", 4),
            (this_or_next|eq, ":var_0", "$g_presentation_obj_custom_banner_12"),
            (eq, ":var_0", "$g_presentation_obj_custom_banner_27"),
            (assign, "$g_presentation_next_presentation", "prsnt_custom_banner"),
            (assign, "$g_presentation_output_slot", 95),
            (start_presentation, "prsnt_banner_charge_selection"),
        (else_try),
            (ge, ":var_1", 4),
            (this_or_next|eq, ":var_0", "$g_presentation_obj_custom_banner_13"),
            (eq, ":var_0", "$g_presentation_obj_custom_banner_31"),
            (assign, "$g_presentation_next_presentation", "prsnt_custom_banner"),
            (assign, "$g_presentation_output_slot", 90),
            (start_presentation, "prsnt_color_selection"),
        (else_try),
            (ge, ":var_1", 1),
            (eq, ":var_0", "$g_presentation_obj_custom_banner_14"),
            (assign, "$g_presentation_next_presentation", "prsnt_custom_banner"),
            (start_presentation, "prsnt_banner_charge_positioning"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_custom_banner_15"),
            (troop_get_slot, ":var_1", "trp_player", slot_troop_custom_banner_num_charges),
            (val_add, ":var_1", 1),
            (val_clamp, ":var_1", 0, 5),
            (troop_set_slot, "trp_player", slot_troop_custom_banner_num_charges, ":var_1"),
            (start_presentation, "prsnt_custom_banner"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_custom_banner_21"),
            (troop_get_slot, ":var_1", "trp_player", slot_troop_custom_banner_num_charges),
            (val_sub, ":var_1", 1),
            (val_clamp, ":var_1", 0, 5),
            (troop_set_slot, "trp_player", slot_troop_custom_banner_num_charges, ":var_1"),
            (start_presentation, "prsnt_custom_banner"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_custom_banner_16"),
            (call_script, "script_get_random_custom_banner", "trp_player"),
            (start_presentation, "prsnt_custom_banner"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_custom_banner_17"),
            (assign, "$g_presentation_next_presentation", "prsnt_custom_banner"),
            (start_presentation, "prsnt_banner_flag_type_selection"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_custom_banner_18"),
            (assign, "$g_presentation_next_presentation", "prsnt_custom_banner"),
            (start_presentation, "prsnt_banner_flag_map_type_selection"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_custom_banner_19"),
            (assign, "$g_presentation_next_presentation", "prsnt_custom_banner"),
            (start_presentation, "prsnt_banner_flag_map_type_selection"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_custom_banner_32"),
            (troop_get_slot, ":var_2", "trp_player", slot_troop_custom_banner_charge_type_1),
            (store_mod, ":var_3", ":var_2", 256),
            (val_div, ":var_2", 256),
            (store_mod, ":var_4", ":var_2", 2),
            (val_div, ":var_2", 2),
            (val_add, ":var_4", 1),
            (val_mod, ":var_4", 2),
            (val_mul, ":var_2", 2),
            (val_add, ":var_2", ":var_4"),
            (val_mul, ":var_2", 256),
            (val_add, ":var_2", ":var_3"),
            (troop_set_slot, "trp_player", slot_troop_custom_banner_charge_type_1, ":var_2"),
            (start_presentation, "prsnt_custom_banner"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_custom_banner_34"),
            (troop_get_slot, ":var_2", "trp_player", slot_troop_custom_banner_charge_type_2),
            (store_mod, ":var_3", ":var_2", 256),
            (val_div, ":var_2", 256),
            (store_mod, ":var_4", ":var_2", 2),
            (val_div, ":var_2", 2),
            (val_add, ":var_4", 1),
            (val_mod, ":var_4", 2),
            (val_mul, ":var_2", 2),
            (val_add, ":var_2", ":var_4"),
            (val_mul, ":var_2", 256),
            (val_add, ":var_2", ":var_3"),
            (troop_set_slot, "trp_player", slot_troop_custom_banner_charge_type_2, ":var_2"),
            (start_presentation, "prsnt_custom_banner"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_custom_banner_36"),
            (troop_get_slot, ":var_2", "trp_player", slot_troop_custom_banner_charge_type_3),
            (store_mod, ":var_3", ":var_2", 256),
            (val_div, ":var_2", 256),
            (store_mod, ":var_4", ":var_2", 2),
            (val_div, ":var_2", 2),
            (val_add, ":var_4", 1),
            (val_mod, ":var_4", 2),
            (val_mul, ":var_2", 2),
            (val_add, ":var_2", ":var_4"),
            (val_mul, ":var_2", 256),
            (val_add, ":var_2", ":var_3"),
            (troop_set_slot, "trp_player", slot_troop_custom_banner_charge_type_3, ":var_2"),
            (start_presentation, "prsnt_custom_banner"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_custom_banner_38"),
            (troop_get_slot, ":var_2", "trp_player", slot_troop_custom_banner_charge_type_4),
            (store_mod, ":var_3", ":var_2", 256),
            (val_div, ":var_2", 256),
            (store_mod, ":var_4", ":var_2", 2),
            (val_div, ":var_2", 2),
            (val_add, ":var_4", 1),
            (val_mod, ":var_4", 2),
            (val_mul, ":var_2", 2),
            (val_add, ":var_2", ":var_4"),
            (val_mul, ":var_2", 256),
            (val_add, ":var_2", ":var_3"),
            (troop_set_slot, "trp_player", slot_troop_custom_banner_charge_type_4, ":var_2"),
            (start_presentation, "prsnt_custom_banner"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_custom_banner_33"),
            (troop_get_slot, ":var_2", "trp_player", slot_troop_custom_banner_charge_type_1),
            (store_div, ":var_4", ":var_2", 512),
            (val_add, ":var_4", 1),
            (val_mod, ":var_4", 2),
            (val_mul, ":var_4", 512),
            (val_mod, ":var_2", 512),
            (val_add, ":var_2", ":var_4"),
            (troop_set_slot, "trp_player", slot_troop_custom_banner_charge_type_1, ":var_2"),
            (start_presentation, "prsnt_custom_banner"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_custom_banner_35"),
            (troop_get_slot, ":var_2", "trp_player", slot_troop_custom_banner_charge_type_2),
            (store_div, ":var_4", ":var_2", 512),
            (val_add, ":var_4", 1),
            (val_mod, ":var_4", 2),
            (val_mul, ":var_4", 512),
            (val_mod, ":var_2", 512),
            (val_add, ":var_2", ":var_4"),
            (troop_set_slot, "trp_player", slot_troop_custom_banner_charge_type_2, ":var_2"),
            (start_presentation, "prsnt_custom_banner"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_custom_banner_37"),
            (troop_get_slot, ":var_2", "trp_player", slot_troop_custom_banner_charge_type_3),
            (store_div, ":var_4", ":var_2", 512),
            (val_add, ":var_4", 1),
            (val_mod, ":var_4", 2),
            (val_mul, ":var_4", 512),
            (val_mod, ":var_2", 512),
            (val_add, ":var_2", ":var_4"),
            (troop_set_slot, "trp_player", slot_troop_custom_banner_charge_type_3, ":var_2"),
            (start_presentation, "prsnt_custom_banner"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_custom_banner_39"),
            (troop_get_slot, ":var_2", "trp_player", slot_troop_custom_banner_charge_type_4),
            (store_div, ":var_4", ":var_2", 512),
            (val_add, ":var_4", 1),
            (val_mod, ":var_4", 2),
            (val_mul, ":var_4", 512),
            (val_mod, ":var_2", 512),
            (val_add, ":var_2", ":var_4"),
            (troop_set_slot, "trp_player", slot_troop_custom_banner_charge_type_4, ":var_2"),
            (start_presentation, "prsnt_custom_banner"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_custom_banner_20"),
            (troop_get_slot, ":var_5", "trp_player", slot_troop_custom_banner_map_flag_type),
            (try_begin),
                (ge, ":var_5", 0),
                (val_add, ":var_5", "icon_custom_banner_01"),
                (party_set_banner_icon, "p_main_party", ":var_5"),
            (try_end),
            (presentation_set_duration, 0),
        (try_end),
    ]),
]),

("banner_charge_positioning", 0, mesh_load_window, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (create_text_overlay, reg1, "str_choose_position", 16),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 600),
        (overlay_set_position, reg1, pos1),
        (assign, ":var_0", 125),
        (assign, ":var_1", 400),
        (call_script, "script_get_troop_custom_banner_num_positionings", "trp_player"),
        (assign, ":var_2", reg0),
        (store_mul, ":var_3", ":var_2", 125),
        (val_sub, ":var_3", 25),
        (store_div, ":var_0", ":var_3", 2),
        (store_sub, ":var_0", 500, ":var_0"),
        (try_for_range, ":var_4", 0, ":var_2"),
            (create_image_button_overlay_with_tableau_material, reg1, -1, "tableau_positioning_selection", ":var_4"),
            (position_set_x, pos1, ":var_0"),
            (position_set_y, pos1, ":var_1"),
            (val_add, ":var_0", 125),
            (overlay_set_position, reg1, pos1),
            (troop_set_slot, "trp_temp_array_a", ":var_4", reg1),
        (try_end),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":var_0"),
        (call_script, "script_get_troop_custom_banner_num_positionings", "trp_player"),
        (assign, ":var_1", reg0),
        (try_for_range, ":var_2", 0, ":var_1"),
            (troop_slot_eq, "trp_temp_array_a", ":var_2", ":var_0"),
            (troop_set_slot, "trp_player", slot_troop_custom_banner_positioning, ":var_2"),
            (assign, ":var_1", 0),
        (try_end),
        (try_begin),
            (gt, "$g_presentation_next_presentation", 0),
            (start_presentation, "$g_presentation_next_presentation"),
        (else_try),
            (presentation_set_duration, 0),
        (try_end),
    ]),
]),

("banner_charge_selection", 0, mesh_load_window, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (create_text_overlay, reg1, "str_choose_charge", 16),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 650),
        (overlay_set_position, reg1, pos1),
        (assign, ":var_0", 100),
        (assign, ":var_1", 600),
        (try_for_range, ":var_2", "mesh_custom_banner_charge_01", "mesh_tableau_mesh_custom_banner"),
            (create_image_button_overlay, reg1, ":var_2", ":var_2"),
            (position_set_x, pos1, ":var_0"),
            (position_set_y, pos1, ":var_1"),
            (val_add, ":var_0", 100),
            (try_begin),
                (gt, ":var_0", 900),
                (assign, ":var_0", 100),
                (val_sub, ":var_1", 100),
            (try_end),
            (overlay_set_position, reg1, pos1),
            (position_set_x, pos1, 80),
            (position_set_y, pos1, 80),
            (overlay_set_size, reg1, pos1),
            (store_sub, ":var_3", ":var_2", "mesh_custom_banner_charge_01"),
            (troop_set_slot, "trp_temp_array_a", ":var_3", reg1),
        (try_end),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":var_0"),
        (assign, ":var_1", "mesh_tableau_mesh_custom_banner"),
        (val_sub, ":var_1", "mesh_custom_banner_charge_01"),
        (try_for_range, ":var_2", 0, ":var_1"),
            (troop_slot_eq, "trp_temp_array_a", ":var_2", ":var_0"),
            (troop_set_slot, "trp_player", "$g_presentation_output_slot", ":var_2"),
            (assign, ":var_1", 0),
        (try_end),
        (try_begin),
            (gt, "$g_presentation_next_presentation", 0),
            (start_presentation, "$g_presentation_next_presentation"),
        (else_try),
            (presentation_set_duration, 0),
        (try_end),
    ]),
]),

("banner_background_selection", 0, mesh_load_window, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (create_text_overlay, reg1, "str_choose_background", 16),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 600),
        (overlay_set_position, reg1, pos1),
        (assign, ":var_0", 75),
        (assign, ":var_1", 450),
        (try_for_range, ":var_2", "mesh_custom_banner_bg", "mesh_custom_banner_charge_01"),
            (store_sub, ":var_3", ":var_2", "mesh_custom_banner_bg"),
            (create_image_button_overlay_with_tableau_material, reg1, -1, "tableau_background_selection", ":var_3"),
            (position_set_x, pos1, ":var_0"),
            (position_set_y, pos1, ":var_1"),
            (val_add, ":var_0", 125),
            (try_begin),
                (gt, ":var_0", 900),
                (assign, ":var_0", 75),
                (val_sub, ":var_1", 125),
            (try_end),
            (overlay_set_position, reg1, pos1),
            (troop_set_slot, "trp_temp_array_a", ":var_3", reg1),
        (try_end),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":var_0"),
        (assign, ":var_1", "mesh_custom_banner_charge_01"),
        (val_sub, ":var_1", "mesh_custom_banner_bg"),
        (try_for_range, ":var_2", 0, ":var_1"),
            (troop_slot_eq, "trp_temp_array_a", ":var_2", ":var_0"),
            (troop_set_slot, "trp_player", slot_troop_custom_banner_bg_type, ":var_2"),
            (assign, ":var_1", 0),
        (try_end),
        (try_begin),
            (gt, "$g_presentation_next_presentation", 0),
            (start_presentation, "$g_presentation_next_presentation"),
        (else_try),
            (presentation_set_duration, 0),
        (try_end),
    ]),
]),

("banner_flag_type_selection", 0, mesh_load_window, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (create_text_overlay, reg1, "str_choose_flag_type", 16),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 600),
        (overlay_set_position, reg1, pos1),
        (assign, ":var_0", 435),
        (assign, ":var_1", 450),
        (try_for_range, ":var_2", "mesh_custom_banner_01", "mesh_custom_banner_bg"),
            (store_sub, ":var_3", ":var_2", "mesh_custom_banner_01"),
            (troop_set_slot, "trp_player", slot_troop_custom_banner_flag_type, ":var_3"),
            (create_image_button_overlay_with_tableau_material, reg1, ":var_2", "tableau_custom_banner_default", "trp_player"),
            (position_set_x, pos1, ":var_0"),
            (position_set_y, pos1, ":var_1"),
            (val_add, ":var_0", 130),
            (overlay_set_position, reg1, pos1),
            (position_set_x, pos1, 100),
            (position_set_y, pos1, 100),
            (overlay_set_size, reg1, pos1),
            (troop_set_slot, "trp_temp_array_a", ":var_3", reg1),
        (try_end),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":var_0"),
        (assign, ":var_1", "mesh_custom_banner_bg"),
        (val_sub, ":var_1", "mesh_custom_banner_01"),
        (try_for_range, ":var_2", 0, ":var_1"),
            (troop_slot_eq, "trp_temp_array_a", ":var_2", ":var_0"),
            (troop_set_slot, "trp_player", slot_troop_custom_banner_flag_type, ":var_2"),
            (assign, ":var_1", 0),
        (try_end),
        (try_begin),
            (gt, "$g_presentation_next_presentation", 0),
            (start_presentation, "$g_presentation_next_presentation"),
        (else_try),
            (presentation_set_duration, 0),
        (try_end),
    ]),
]),

("banner_flag_map_type_selection", 0, mesh_load_window, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (create_text_overlay, reg1, "str_choose_map_flag_type", 16),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 600),
        (overlay_set_position, reg1, pos1),
        (troop_get_slot, ":var_0", "trp_player", slot_troop_custom_banner_bg_type),
        (val_add, ":var_0", "mesh_custom_banner_bg"),
        (assign, ":var_1", 250),
        (assign, ":var_2", 150),
        (try_for_range, ":var_3", "mesh_custom_map_banner_01", "mesh_custom_banner_01"),
            (store_sub, ":var_4", ":var_3", "mesh_custom_map_banner_01"),
            (troop_set_slot, "trp_player", slot_troop_custom_banner_map_flag_type, ":var_4"),
            (try_begin),
                (eq, ":var_3", "mesh_custom_map_banner_01"),
                (create_image_button_overlay_with_tableau_material, reg1, ":var_3", "tableau_custom_banner_square", "trp_player"),
            (else_try),
                (eq, ":var_3", "mesh_custom_map_banner_02"),
                (create_image_button_overlay_with_tableau_material, reg1, ":var_3", "tableau_custom_banner_short", "trp_player"),
            (else_try),
                (create_image_button_overlay_with_tableau_material, reg1, ":var_3", "tableau_custom_banner_tall", "trp_player"),
            (try_end),
            (position_set_x, pos1, ":var_1"),
            (position_set_y, pos1, ":var_2"),
            (val_add, ":var_1", 200),
            (overlay_set_position, reg1, pos1),
            (position_set_x, pos1, 100),
            (position_set_y, pos1, 100),
            (overlay_set_size, reg1, pos1),
            (troop_set_slot, "trp_temp_array_a", ":var_4", reg1),
        (try_end),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":var_0"),
        (assign, ":var_1", "mesh_custom_banner_01"),
        (val_sub, ":var_1", "mesh_custom_map_banner_01"),
        (try_for_range, ":var_2", 0, ":var_1"),
            (troop_slot_eq, "trp_temp_array_a", ":var_2", ":var_0"),
            (troop_set_slot, "trp_player", slot_troop_custom_banner_map_flag_type, ":var_2"),
            (assign, ":var_1", 0),
        (try_end),
        (try_begin),
            (gt, "$g_presentation_next_presentation", 0),
            (start_presentation, "$g_presentation_next_presentation"),
        (else_try),
            (presentation_set_duration, 0),
        (try_end),
    ]),
]),

("color_selection", 0, mesh_load_window, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (create_text_overlay, reg1, "str_choose_color", 16),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 600),
        (overlay_set_position, reg1, pos1),
        (assign, ":var_0", 125),
        (assign, ":var_1", 450),
        (try_for_range, ":var_2", 0, 42),
            (call_script, "script_get_custom_banner_color_from_index", ":var_2"),
            (assign, ":var_3", reg0),
            (create_image_button_overlay_with_tableau_material, reg1, "mesh_color_picker", "tableau_color_picker", ":var_3"),
            (position_set_x, pos1, ":var_0"),
            (position_set_y, pos1, ":var_1"),
            (val_add, ":var_0", 50),
            (try_begin),
                (store_mod, ":var_4", ":var_2", 7),
                (eq, ":var_4", 6),
                (assign, ":var_0", 125),
                (val_sub, ":var_1", 50),
            (try_end),
            (overlay_set_position, reg1, pos1),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 500),
            (overlay_set_size, reg1, pos1),
            (store_mul, ":var_5", ":var_2", 2),
            (store_add, ":var_6", ":var_5", 1),
            (troop_set_slot, "trp_temp_array_a", ":var_5", reg1),
            (troop_set_slot, "trp_temp_array_a", ":var_6", ":var_3"),
        (try_end),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":var_0"),
        (assign, ":var_1", 64),
        (try_for_range, ":var_2", 0, ":var_1"),
            (store_mul, ":var_3", ":var_2", 2),
            (troop_slot_eq, "trp_temp_array_a", ":var_3", ":var_0"),
            (store_add, ":var_4", ":var_3", 1),
            (troop_get_slot, ":var_5", "trp_temp_array_a", ":var_4"),
            (troop_set_slot, "trp_player", "$g_presentation_output_slot", ":var_5"),
            (assign, ":var_1", 0),
        (try_end),
        (try_begin),
            (gt, "$g_presentation_next_presentation", 0),
            (start_presentation, "$g_presentation_next_presentation"),
        (else_try),
            (presentation_set_duration, 0),
        (try_end),
    ]),
]),

("marshall_selection", 0, mesh_load_window, [
    (ti_on_presentation_load, [
        (assign, "$g_presentation_obj_marshall_selection_1", -1),
        (assign, "$g_presentation_obj_marshall_selection_2", -1),
        (assign, "$g_presentation_obj_marshall_selection_3", -1),
        (set_fixed_point_multiplier, 1000),
        (assign, "$g_presentation_next_presentation", -1),
        (store_add, ":var_0", "$g_presentation_marshall_selection_max_renown_1", "$g_presentation_marshall_selection_max_renown_2"),
        (faction_get_slot, ":var_1", "$players_kingdom", slot_faction_leader),
        (str_store_troop_name, s1, "$g_presentation_marshall_selection_max_renown_1_troop"),
        (create_text_overlay, reg1, "@Candidate #1: {s1}", 16),
        (position_set_x, pos1, 200),
        (position_set_y, pos1, 600),
        (overlay_set_position, reg1, pos1),
        (str_store_troop_name, s1, "$g_presentation_marshall_selection_max_renown_2_troop"),
        (create_text_overlay, reg1, "@Candidate #2: {s1}", 16),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 600),
        (overlay_set_position, reg1, pos1),
        (create_mesh_overlay_with_tableau_material, reg1, -1, "tableau_troop_note_mesh", "$g_presentation_marshall_selection_max_renown_1_troop"),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 500),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 100),
        (position_set_y, pos1, 300),
        (overlay_set_position, reg1, pos1),
        (create_mesh_overlay_with_tableau_material, reg1, -1, "tableau_troop_note_mesh", "$g_presentation_marshall_selection_max_renown_2_troop"),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 500),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 700),
        (position_set_y, pos1, 300),
        (overlay_set_position, reg1, pos1),
        (assign, ":var_2", "$g_presentation_input"),
        (val_add, "$g_presentation_input", 1),
        (try_begin),
            (neg|ge, ":var_2", 0),
            (str_store_troop_name, s1, "$g_presentation_marshall_selection_max_renown_1_troop"),
            (str_store_troop_name, s2, "$g_presentation_marshall_selection_max_renown_2_troop"),
            (str_store_troop_name, s3, ":var_1"),
            (str_store_faction_name, s4, "$players_kingdom"),
            (create_text_overlay, reg1, "@{s3} of {s4} wishes to select a new marshall and invites his vassals for a counsel. {s1} and {s2} are the likely candidates.", 16),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 200),
            (overlay_set_position, reg1, pos1),
            (create_button_overlay, "$g_presentation_obj_marshall_selection_1", "@Continue...", 16),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 100),
            (overlay_set_position, "$g_presentation_obj_marshall_selection_1", pos1),
            (assign, "$g_presentation_next_presentation", "prsnt_marshall_selection"),
        (else_try),
            (assign, ":var_3", ":var_2"),
            (try_for_range_backwards, ":var_4", "trp_kingdom_heroes_including_player_begin", "trp_knight_1_1_wife"),
                (ge, ":var_3", 0),
                (assign, ":var_5", ":var_4"),
                (assign, ":var_6", 0),
                (try_begin),
                    (eq, ":var_4", "trp_kingdom_heroes_including_player_begin"),
                    (assign, ":var_5", "trp_player"),
                    (try_begin),
                        (eq, "$g_player_is_captive", 0),
                        (assign, ":var_6", 1),
                    (try_end),
                (else_try),
                    (store_troop_faction, ":var_7", ":var_5"),
                    (eq, "$players_kingdom", ":var_7"),
                    (neg|troop_slot_ge, ":var_5", slot_troop_prisoner_of_party, 0),
                    (troop_slot_ge, ":var_5", slot_troop_leaded_party, 1),
                    (troop_slot_eq, ":var_5", slot_troop_occupation, 2),
                    (neg|faction_slot_eq, ":var_7", slot_faction_leader, ":var_5"),
                    (assign, ":var_6", 1),
                (try_end),
                (eq, ":var_6", 1),
                (neg|eq, "$g_presentation_marshall_selection_max_renown_1_troop", ":var_5"),
                (neg|eq, "$g_presentation_marshall_selection_max_renown_2_troop", ":var_5"),
                (val_sub, ":var_3", 1),
                (neg|ge, ":var_3", 0),
                (assign, "$g_presentation_next_presentation", "prsnt_marshall_selection"),
                (create_mesh_overlay_with_tableau_material, reg1, -1, "tableau_troop_note_mesh", ":var_5"),
                (position_set_x, pos1, 300),
                (position_set_y, pos1, 300),
                (overlay_set_size, reg1, pos1),
                (position_set_x, pos1, 440),
                (position_set_y, pos1, 400),
                (overlay_set_position, reg1, pos1),
                (try_begin),
                    (eq, ":var_5", "trp_player"),
                    (create_text_overlay, reg1, "@Who do you wish to support?", 16),
                    (position_set_x, pos1, 500),
                    (position_set_y, pos1, 200),
                    (overlay_set_position, reg1, pos1),
                    (str_store_troop_name, s1, "$g_presentation_marshall_selection_max_renown_1_troop"),
                    (create_button_overlay, "$g_presentation_obj_marshall_selection_2", "@{!}{s1}", 16),
                    (position_set_x, pos1, 300),
                    (position_set_y, pos1, 100),
                    (overlay_set_position, "$g_presentation_obj_marshall_selection_2", pos1),
                    (str_store_troop_name, s1, "$g_presentation_marshall_selection_max_renown_2_troop"),
                    (create_button_overlay, "$g_presentation_obj_marshall_selection_3", "@{!}{s1}", 16),
                    (position_set_x, pos1, 700),
                    (position_set_y, pos1, 100),
                    (overlay_set_position, "$g_presentation_obj_marshall_selection_3", pos1),
                (else_try),
                    (str_store_troop_name, s1, ":var_5"),
                    (store_random_in_range, ":var_8", 0, ":var_0"),
                    (val_sub, ":var_8", "$g_presentation_marshall_selection_max_renown_1"),
                    (try_begin),
                        (neg|ge, ":var_8", 0),
                        (val_add, "$g_presentation_marshall_selection_1_vote", 1),
                        (str_store_troop_name, s2, "$g_presentation_marshall_selection_max_renown_1_troop"),
                    (else_try),
                        (val_add, "$g_presentation_marshall_selection_2_vote", 1),
                        (str_store_troop_name, s2, "$g_presentation_marshall_selection_max_renown_2_troop"),
                    (try_end),
                    (create_text_overlay, reg1, "@{s1} gives his support to {s2}.", 16),
                    (position_set_x, pos1, 500),
                    (position_set_y, pos1, 200),
                    (overlay_set_position, reg1, pos1),
                    (create_button_overlay, "$g_presentation_obj_marshall_selection_1", "@Continue...", 16),
                    (position_set_x, pos1, 500),
                    (position_set_y, pos1, 100),
                    (overlay_set_position, "$g_presentation_obj_marshall_selection_1", pos1),
                (try_end),
            (try_end),
        (try_end),
        (assign, reg0, "$g_presentation_marshall_selection_1_vote"),
        (create_text_overlay, reg1, "@Number of Supporters: {reg0}", 16),
        (position_set_x, pos1, 200),
        (position_set_y, pos1, 550),
        (overlay_set_position, reg1, pos1),
        (assign, reg0, "$g_presentation_marshall_selection_2_vote"),
        (create_text_overlay, reg1, "@Number of Supporters: {reg0}", 16),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 550),
        (overlay_set_position, reg1, pos1),
        (try_begin),
            (neg|ge, "$g_presentation_next_presentation", 0),
            (try_begin),
                (gt, "$g_presentation_marshall_selection_2_vote", "$g_presentation_marshall_selection_1_vote"),
                (assign, ":var_9", "$g_presentation_marshall_selection_max_renown_1_troop"),
                (assign, "$g_presentation_marshall_selection_max_renown_1_troop", "$g_presentation_marshall_selection_max_renown_2_troop"),
                (assign, "$g_presentation_marshall_selection_max_renown_2_troop", ":var_9"),
            (try_end),
            (str_store_troop_name, s1, "$g_presentation_marshall_selection_max_renown_1_troop"),
            (str_store_troop_name, s2, ":var_1"),
            (str_store_faction_name, s3, "$players_kingdom"),
            (create_text_overlay, reg1, "@{s2} has heard his vassals' counsel. He selects {s1} as the marshall of {s3}.", 16),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 200),
            (overlay_set_position, reg1, pos1),
            (create_button_overlay, "$g_presentation_obj_marshall_selection_1", "@Continue...", 16),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 100),
            (overlay_set_position, "$g_presentation_obj_marshall_selection_1", pos1),
        (try_end),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":var_0"),
        (try_begin),
            (eq, ":var_0", "$g_presentation_obj_marshall_selection_2"),
            (val_add, "$g_presentation_marshall_selection_1_vote", 1),
            (call_script, "script_change_player_relation_with_troop", "$g_presentation_marshall_selection_max_renown_1_troop", 2),
            (call_script, "script_change_player_relation_with_troop", "$g_presentation_marshall_selection_max_renown_2_troop", -2),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_marshall_selection_3"),
            (val_add, "$g_presentation_marshall_selection_2_vote", 1),
            (call_script, "script_change_player_relation_with_troop", "$g_presentation_marshall_selection_max_renown_1_troop", -2),
            (call_script, "script_change_player_relation_with_troop", "$g_presentation_marshall_selection_max_renown_2_troop", 2),
        (try_end),
        (try_begin),
            (this_or_next|eq, ":var_0", "$g_presentation_obj_marshall_selection_1"),
            (this_or_next|eq, ":var_0", "$g_presentation_obj_marshall_selection_2"),
            (eq, ":var_0", "$g_presentation_obj_marshall_selection_3"),
            (try_begin),
                (ge, "$g_presentation_next_presentation", 0),
                (start_presentation, "$g_presentation_next_presentation"),
            (else_try),
                (try_begin),
                    (neg|faction_slot_eq, "$players_kingdom", slot_faction_marshall, "$g_presentation_marshall_selection_max_renown_1_troop"),
                    (call_script, "script_check_and_finish_active_army_quests_for_faction", "$players_kingdom"),
                (try_end),
                (faction_get_slot, ":var_1", "$players_kingdom", slot_faction_marshall),
                (try_begin),
                    (ge, ":var_1", 0),
                    (party_is_active, ":var_1"),
                    (party_set_marshall, ":var_1", 0),
                (try_end),
                (faction_set_slot, "$players_kingdom", slot_faction_marshall, "$g_presentation_marshall_selection_max_renown_1_troop"),
                (try_begin),
                    (eq, "$g_presentation_marshall_selection_max_renown_1_troop", "trp_player"),
                    (call_script, "script_change_player_relation_with_troop", "$g_presentation_marshall_selection_max_renown_2_troop", -3),
                (try_end),
                (assign, "$g_recalculate_ais", 1),
                (assign, "$g_presentation_marshall_selection_ended", 1),
                (presentation_set_duration, 0),
            (try_end),
        (try_end),
    ]),
]),

("battle", 0, 0, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (assign, "$g_formation_group0_selected", 0),
        (assign, "$g_formation_group1_selected", 0),
        (assign, "$g_formation_group2_selected", 0),
        (assign, "$g_formation_group3_selected", 0),
        (assign, "$g_formation_group4_selected", 0),
        (assign, "$g_formation_group5_selected", 0),
        (assign, "$g_formation_group6_selected", 0),
        (assign, "$g_formation_group7_selected", 0),
        (assign, "$g_formation_group8_selected", 0),
        (assign, "$g_presentation_obj_battle_but0", -1),
        (assign, "$g_presentation_obj_battle_but1", -1),
        (assign, "$g_presentation_obj_battle_but2", -1),
        (assign, "$g_presentation_obj_battle_but3", -1),
        (assign, "$g_presentation_obj_battle_but4", -1),
        (assign, "$g_presentation_obj_battle_but5", -1),
        (assign, "$g_presentation_obj_battle_but6", -1),
        (assign, "$g_presentation_obj_battle_but7", -1),
        (assign, "$g_presentation_obj_battle_but8", -1),
        (str_clear, s7),
        (try_for_agents, ":var_0"),
            (agent_set_slot, ":var_0", slot_agent_map_overlay_id, 0),
        (try_end),
        (get_player_agent_no, ":var_1"),
        (agent_get_troop_id, ":var_2", ":var_1"),
        (position_set_y, pos1, 700),
        (create_text_overlay, reg1, "@Action", 98320),
        (overlay_set_color, reg1, 4289374890),
        (position_set_x, pos1, 270),
        (overlay_set_position, reg1, pos1),
        (create_text_overlay, reg1, "@Mount", 98320),
        (overlay_set_color, reg1, 4289374890),
        (position_set_x, pos1, 410),
        (overlay_set_position, reg1, pos1),
        (create_text_overlay, reg1, "@Attack Type", 98320),
        (overlay_set_color, reg1, 4289374890),
        (position_set_x, pos1, 550),
        (overlay_set_position, reg1, pos1),
        (assign, "$group0_has_troops", 0),
        (assign, "$group1_has_troops", 0),
        (assign, "$group2_has_troops", 0),
        (assign, "$group3_has_troops", 0),
        (assign, "$group4_has_troops", 0),
        (assign, "$group5_has_troops", 0),
        (assign, "$group6_has_troops", 0),
        (assign, "$group7_has_troops", 0),
        (assign, "$group8_has_troops", 0),
        (party_get_num_companion_stacks, ":var_3", "p_main_party"),
        (assign, "$num_classes", 0),
        (try_for_range, ":var_4", 0, ":var_3"),
            (party_stack_get_troop_id, ":var_5", "p_main_party", ":var_4"),
            (troop_get_class, ":var_6", ":var_5"),
            (neg|eq, ":var_2", ":var_5"),
            (try_begin),
                (eq, ":var_6", 0),
                (try_begin),
                    (neg|eq, "$group0_has_troops", 1),
                    (val_add, "$num_classes", 1),
                (try_end),
                (assign, "$group0_has_troops", 1),
            (else_try),
                (eq, ":var_6", 1),
                (try_begin),
                    (neg|eq, "$group1_has_troops", 1),
                    (val_add, "$num_classes", 1),
                (try_end),
                (assign, "$group1_has_troops", 1),
            (else_try),
                (eq, ":var_6", 2),
                (try_begin),
                    (neg|eq, "$group2_has_troops", 1),
                    (val_add, "$num_classes", 1),
                (try_end),
                (assign, "$group2_has_troops", 1),
            (else_try),
                (eq, ":var_6", 3),
                (try_begin),
                    (neg|eq, "$group3_has_troops", 1),
                    (val_add, "$num_classes", 1),
                (try_end),
                (assign, "$group3_has_troops", 1),
            (else_try),
                (eq, ":var_6", 4),
                (try_begin),
                    (neg|eq, "$group4_has_troops", 1),
                    (val_add, "$num_classes", 1),
                (try_end),
                (assign, "$group4_has_troops", 1),
            (else_try),
                (eq, ":var_6", 5),
                (try_begin),
                    (neg|eq, "$group5_has_troops", 1),
                    (val_add, "$num_classes", 1),
                (try_end),
                (assign, "$group5_has_troops", 1),
            (else_try),
                (eq, ":var_6", 6),
                (try_begin),
                    (neg|eq, "$group6_has_troops", 1),
                    (val_add, "$num_classes", 1),
                (try_end),
                (assign, "$group6_has_troops", 1),
            (else_try),
                (eq, ":var_6", 7),
                (try_begin),
                    (neg|eq, "$group7_has_troops", 1),
                    (val_add, "$num_classes", 1),
                (try_end),
                (assign, "$group7_has_troops", 1),
            (else_try),
                (eq, ":var_6", 8),
                (try_begin),
                    (neg|eq, "$group8_has_troops", 1),
                    (val_add, "$num_classes", 1),
                (try_end),
                (assign, "$group8_has_troops", 1),
            (try_end),
        (try_end),
        (assign, ":var_7", 0),
        (assign, ":var_8", 653),
        (assign, ":var_9", 20),
        (assign, ":var_10", 662),
        (assign, ":var_11", 50),
        (assign, ":var_12", 660),
        (try_begin),
            (eq, "$group0_has_troops", 1),
            (create_image_button_overlay, "$g_presentation_obj_battle_but0", "mesh_white_plane", "mesh_white_plane"),
            (position_set_x, pos1, ":var_7"),
            (position_set_y, pos1, ":var_8"),
            (overlay_set_position, "$g_presentation_obj_battle_but0", pos1),
            (val_add, ":var_8", -40),
            (position_set_x, pos1, 32500),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_presentation_obj_battle_but0", pos1),
            (overlay_set_alpha, "$g_presentation_obj_battle_but0", 0),
            (overlay_set_color, "$g_presentation_obj_battle_but0", 16776960),
            (create_check_box_overlay, "$g_presentation_obj_battle_check0", "mesh_checkbox_off", "mesh_checkbox_on"),
            (position_set_x, pos2, ":var_9"),
            (position_set_y, pos2, ":var_10"),
            (overlay_set_position, "$g_presentation_obj_battle_check0", pos2),
            (val_add, ":var_10", -40),
            (create_text_overlay, "$g_presentation_obj_battle_name0", 7, 0),
            (position_set_x, pos3, ":var_11"),
            (position_set_y, pos3, ":var_12"),
            (overlay_set_position, "$g_presentation_obj_battle_name0", pos3),
            (val_add, ":var_12", -40),
            (create_text_overlay, "$g_presentation_but0_movement", 7, 16),
            (create_text_overlay, "$g_presentation_but0_riding", 7, 16),
            (create_text_overlay, "$g_presentation_but0_weapon_usage", 7, 16),
        (try_end),
        (try_begin),
            (eq, "$group1_has_troops", 1),
            (create_image_button_overlay, "$g_presentation_obj_battle_but1", "mesh_white_plane", "mesh_white_plane"),
            (position_set_x, pos1, ":var_7"),
            (position_set_y, pos1, ":var_8"),
            (overlay_set_position, "$g_presentation_obj_battle_but1", pos1),
            (val_add, ":var_8", -40),
            (position_set_x, pos1, 32500),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_presentation_obj_battle_but1", pos1),
            (overlay_set_alpha, "$g_presentation_obj_battle_but1", 0),
            (overlay_set_color, "$g_presentation_obj_battle_but1", 16776960),
            (create_check_box_overlay, "$g_presentation_obj_battle_check1", "mesh_checkbox_off", "mesh_checkbox_on"),
            (position_set_x, pos2, ":var_9"),
            (position_set_y, pos2, ":var_10"),
            (overlay_set_position, "$g_presentation_obj_battle_check1", pos2),
            (val_add, ":var_10", -40),
            (create_text_overlay, "$g_presentation_obj_battle_name1", 7, 0),
            (position_set_x, pos3, ":var_11"),
            (position_set_y, pos3, ":var_12"),
            (overlay_set_position, "$g_presentation_obj_battle_name1", pos3),
            (val_add, ":var_12", -40),
            (create_text_overlay, "$g_presentation_but1_movement", 7, 16),
            (create_text_overlay, "$g_presentation_but1_riding", 7, 16),
            (create_text_overlay, "$g_presentation_but1_weapon_usage", 7, 16),
        (try_end),
        (try_begin),
            (eq, "$group2_has_troops", 1),
            (create_image_button_overlay, "$g_presentation_obj_battle_but2", "mesh_white_plane", "mesh_white_plane"),
            (position_set_x, pos1, ":var_7"),
            (position_set_y, pos1, ":var_8"),
            (overlay_set_position, "$g_presentation_obj_battle_but2", pos1),
            (val_add, ":var_8", -40),
            (position_set_x, pos1, 32500),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_presentation_obj_battle_but2", pos1),
            (overlay_set_alpha, "$g_presentation_obj_battle_but2", 0),
            (overlay_set_color, "$g_presentation_obj_battle_but2", 16776960),
            (create_check_box_overlay, "$g_presentation_obj_battle_check2", "mesh_checkbox_off", "mesh_checkbox_on"),
            (position_set_x, pos2, ":var_9"),
            (position_set_y, pos2, ":var_10"),
            (overlay_set_position, "$g_presentation_obj_battle_check2", pos2),
            (val_add, ":var_10", -40),
            (create_text_overlay, "$g_presentation_obj_battle_name2", 7, 0),
            (position_set_x, pos3, ":var_11"),
            (position_set_y, pos3, ":var_12"),
            (overlay_set_position, "$g_presentation_obj_battle_name2", pos3),
            (val_add, ":var_12", -40),
            (create_text_overlay, "$g_presentation_but2_movement", 7, 16),
            (create_text_overlay, "$g_presentation_but2_riding", 7, 16),
            (create_text_overlay, "$g_presentation_but2_weapon_usage", 7, 16),
        (try_end),
        (try_begin),
            (eq, "$group3_has_troops", 1),
            (create_image_button_overlay, "$g_presentation_obj_battle_but3", "mesh_white_plane", "mesh_white_plane"),
            (position_set_x, pos1, ":var_7"),
            (position_set_y, pos1, ":var_8"),
            (overlay_set_position, "$g_presentation_obj_battle_but3", pos1),
            (val_add, ":var_8", -40),
            (position_set_x, pos1, 32500),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_presentation_obj_battle_but3", pos1),
            (overlay_set_alpha, "$g_presentation_obj_battle_but3", 0),
            (overlay_set_color, "$g_presentation_obj_battle_but3", 16776960),
            (create_check_box_overlay, "$g_presentation_obj_battle_check3", "mesh_checkbox_off", "mesh_checkbox_on"),
            (position_set_x, pos2, ":var_9"),
            (position_set_y, pos2, ":var_10"),
            (overlay_set_position, "$g_presentation_obj_battle_check3", pos2),
            (val_add, ":var_10", -40),
            (create_text_overlay, "$g_presentation_obj_battle_name3", 7, 0),
            (position_set_x, pos3, ":var_11"),
            (position_set_y, pos3, ":var_12"),
            (overlay_set_position, "$g_presentation_obj_battle_name3", pos3),
            (val_add, ":var_12", -40),
            (create_text_overlay, "$g_presentation_but3_movement", 7, 16),
            (create_text_overlay, "$g_presentation_but3_riding", 7, 16),
            (create_text_overlay, "$g_presentation_but3_weapon_usage", 7, 16),
        (try_end),
        (try_begin),
            (eq, "$group4_has_troops", 1),
            (create_image_button_overlay, "$g_presentation_obj_battle_but4", "mesh_white_plane", "mesh_white_plane"),
            (position_set_x, pos1, ":var_7"),
            (position_set_y, pos1, ":var_8"),
            (overlay_set_position, "$g_presentation_obj_battle_but4", pos1),
            (val_add, ":var_8", -40),
            (position_set_x, pos1, 32500),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_presentation_obj_battle_but4", pos1),
            (overlay_set_alpha, "$g_presentation_obj_battle_but4", 0),
            (overlay_set_color, "$g_presentation_obj_battle_but4", 16776960),
            (create_check_box_overlay, "$g_presentation_obj_battle_check4", "mesh_checkbox_off", "mesh_checkbox_on"),
            (position_set_x, pos2, ":var_9"),
            (position_set_y, pos2, ":var_10"),
            (overlay_set_position, "$g_presentation_obj_battle_check4", pos2),
            (val_add, ":var_10", -40),
            (create_text_overlay, "$g_presentation_obj_battle_name4", 7, 0),
            (position_set_x, pos3, ":var_11"),
            (position_set_y, pos3, ":var_12"),
            (overlay_set_position, "$g_presentation_obj_battle_name4", pos3),
            (val_add, ":var_12", -40),
            (create_text_overlay, "$g_presentation_but4_movement", 7, 16),
            (create_text_overlay, "$g_presentation_but4_riding", 7, 16),
            (create_text_overlay, "$g_presentation_but4_weapon_usage", 7, 16),
        (try_end),
        (try_begin),
            (eq, "$group5_has_troops", 1),
            (create_image_button_overlay, "$g_presentation_obj_battle_but5", "mesh_white_plane", "mesh_white_plane"),
            (position_set_x, pos1, ":var_7"),
            (position_set_y, pos1, ":var_8"),
            (overlay_set_position, "$g_presentation_obj_battle_but5", pos1),
            (val_add, ":var_8", -40),
            (position_set_x, pos1, 32500),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_presentation_obj_battle_but5", pos1),
            (overlay_set_alpha, "$g_presentation_obj_battle_but5", 0),
            (overlay_set_color, "$g_presentation_obj_battle_but5", 16776960),
            (create_check_box_overlay, "$g_presentation_obj_battle_check5", "mesh_checkbox_off", "mesh_checkbox_on"),
            (position_set_x, pos2, ":var_9"),
            (position_set_y, pos2, ":var_10"),
            (overlay_set_position, "$g_presentation_obj_battle_check5", pos2),
            (val_add, ":var_10", -40),
            (create_text_overlay, "$g_presentation_obj_battle_name5", 7, 0),
            (position_set_x, pos3, ":var_11"),
            (position_set_y, pos3, ":var_12"),
            (overlay_set_position, "$g_presentation_obj_battle_name5", pos3),
            (val_add, ":var_12", -40),
            (create_text_overlay, "$g_presentation_but5_movement", 7, 16),
            (create_text_overlay, "$g_presentation_but5_riding", 7, 16),
            (create_text_overlay, "$g_presentation_but5_weapon_usage", 7, 16),
        (try_end),
        (try_begin),
            (eq, "$group6_has_troops", 1),
            (create_image_button_overlay, "$g_presentation_obj_battle_but6", "mesh_white_plane", "mesh_white_plane"),
            (position_set_x, pos1, ":var_7"),
            (position_set_y, pos1, ":var_8"),
            (overlay_set_position, "$g_presentation_obj_battle_but6", pos1),
            (val_add, ":var_8", -40),
            (position_set_x, pos1, 32500),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_presentation_obj_battle_but6", pos1),
            (overlay_set_alpha, "$g_presentation_obj_battle_but6", 0),
            (overlay_set_color, "$g_presentation_obj_battle_but6", 16776960),
            (create_check_box_overlay, "$g_presentation_obj_battle_check6", "mesh_checkbox_off", "mesh_checkbox_on"),
            (position_set_x, pos2, ":var_9"),
            (position_set_y, pos2, ":var_10"),
            (overlay_set_position, "$g_presentation_obj_battle_check6", pos2),
            (val_add, ":var_10", -40),
            (create_text_overlay, "$g_presentation_obj_battle_name6", 7, 0),
            (position_set_x, pos3, ":var_11"),
            (position_set_y, pos3, ":var_12"),
            (overlay_set_position, "$g_presentation_obj_battle_name6", pos3),
            (val_add, ":var_12", -40),
            (create_text_overlay, "$g_presentation_but6_movement", 7, 16),
            (create_text_overlay, "$g_presentation_but6_riding", 7, 16),
            (create_text_overlay, "$g_presentation_but6_weapon_usage", 7, 16),
        (try_end),
        (try_begin),
            (eq, "$group7_has_troops", 1),
            (create_image_button_overlay, "$g_presentation_obj_battle_but7", "mesh_white_plane", "mesh_white_plane"),
            (position_set_x, pos1, ":var_7"),
            (position_set_y, pos1, ":var_8"),
            (overlay_set_position, "$g_presentation_obj_battle_but7", pos1),
            (val_add, ":var_8", -40),
            (position_set_x, pos1, 32500),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_presentation_obj_battle_but7", pos1),
            (overlay_set_alpha, "$g_presentation_obj_battle_but7", 0),
            (overlay_set_color, "$g_presentation_obj_battle_but7", 16776960),
            (create_check_box_overlay, "$g_presentation_obj_battle_check7", "mesh_checkbox_off", "mesh_checkbox_on"),
            (position_set_x, pos2, ":var_9"),
            (position_set_y, pos2, ":var_10"),
            (overlay_set_position, "$g_presentation_obj_battle_check7", pos2),
            (val_add, ":var_10", -40),
            (create_text_overlay, "$g_presentation_obj_battle_name7", 7, 0),
            (position_set_x, pos3, ":var_11"),
            (position_set_y, pos3, ":var_12"),
            (overlay_set_position, "$g_presentation_obj_battle_name7", pos3),
            (val_add, ":var_12", -40),
            (create_text_overlay, "$g_presentation_but7_movement", 7, 16),
            (create_text_overlay, "$g_presentation_but7_riding", 7, 16),
            (create_text_overlay, "$g_presentation_but7_weapon_usage", 7, 16),
        (try_end),
        (try_begin),
            (eq, "$group8_has_troops", 1),
            (create_image_button_overlay, "$g_presentation_obj_battle_but8", "mesh_white_plane", "mesh_white_plane"),
            (position_set_x, pos1, ":var_7"),
            (position_set_y, pos1, ":var_8"),
            (overlay_set_position, "$g_presentation_obj_battle_but8", pos1),
            (val_add, ":var_8", -40),
            (position_set_x, pos1, 32500),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_presentation_obj_battle_but8", pos1),
            (overlay_set_alpha, "$g_presentation_obj_battle_but8", 0),
            (overlay_set_color, "$g_presentation_obj_battle_but8", 16776960),
            (create_check_box_overlay, "$g_presentation_obj_battle_check8", "mesh_checkbox_off", "mesh_checkbox_on"),
            (position_set_x, pos2, ":var_9"),
            (position_set_y, pos2, ":var_10"),
            (overlay_set_position, "$g_presentation_obj_battle_check8", pos2),
            (val_add, ":var_10", -40),
            (create_text_overlay, "$g_presentation_obj_battle_name8", 7, 0),
            (position_set_x, pos3, ":var_11"),
            (position_set_y, pos3, ":var_12"),
            (overlay_set_position, "$g_presentation_obj_battle_name8", pos3),
            (val_add, ":var_12", -40),
            (create_text_overlay, "$g_presentation_but8_movement", 7, 16),
            (create_text_overlay, "$g_presentation_but8_riding", 7, 16),
            (create_text_overlay, "$g_presentation_but8_weapon_usage", 7, 16),
        (try_end),
        (get_player_agent_no, ":var_1"),
        (agent_get_team, ":var_13", ":var_1"),
        (call_script, "script_update_order_panel", ":var_13"),
        (assign, ":var_14", 640),
        (assign, ":var_15", "$num_classes"),
        (val_mul, ":var_15", -40),
        (val_add, ":var_14", ":var_15"),
        (create_listbox_overlay, "$g_presentation_obj_battle_10", "str_space", 0),
        (create_listbox_overlay, "$g_presentation_obj_battle_11", "str_space", 0),
        (create_listbox_overlay, "$g_presentation_obj_battle_12", "str_space", 0),
        (create_listbox_overlay, "$g_presentation_obj_battle_13", "str_space", 0),
        (overlay_add_item, "$g_presentation_obj_battle_10", "@Stand Ground"),
        (overlay_add_item, "$g_presentation_obj_battle_10", "@Charge"),
        (overlay_add_item, "$g_presentation_obj_battle_10", "@Follow Me"),
        (overlay_add_item, "$g_presentation_obj_battle_10", "@Hold This Position"),
        (create_button_overlay, "$g_presentation_obj_battle_14", "@Spread Out", 98320),
        (overlay_set_color, "$g_presentation_obj_battle_14", 4294967295),
        (create_button_overlay, "$g_presentation_obj_battle_15", "@Stand Closer", 98320),
        (overlay_set_color, "$g_presentation_obj_battle_15", 4294967295),
        (create_button_overlay, "$g_presentation_obj_battle_16", "@Fall Back", 98320),
        (overlay_set_color, "$g_presentation_obj_battle_16", 4294967295),
        (create_button_overlay, "$g_presentation_obj_battle_17", "@Advance", 98320),
        (overlay_set_color, "$g_presentation_obj_battle_17", 4294967295),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 600),
        (overlay_set_size, "$g_presentation_obj_battle_10", pos1),
        (val_add, ":var_14", -35),
        (position_set_x, pos1, 205),
        (position_set_y, pos1, ":var_14"),
        (val_add, ":var_14", 35),
        (overlay_set_position, "$g_presentation_obj_battle_10", pos1),
        (overlay_set_alpha, "$g_presentation_obj_battle_10", 96),
        (overlay_set_val, "$g_presentation_obj_battle_10", "$g_latest_order_1"),
        (val_add, ":var_14", -40),
        (position_set_x, pos1, 130),
        (position_set_y, pos1, ":var_14"),
        (val_add, ":var_14", 40),
        (overlay_set_position, "$g_presentation_obj_battle_14", pos1),
        (val_add, ":var_14", -20),
        (position_set_x, pos1, 130),
        (position_set_y, pos1, ":var_14"),
        (val_add, ":var_14", 20),
        (overlay_set_position, "$g_presentation_obj_battle_15", pos1),
        (val_add, ":var_14", 0),
        (position_set_x, pos1, 130),
        (position_set_y, pos1, ":var_14"),
        (val_add, ":var_14", 0),
        (overlay_set_position, "$g_presentation_obj_battle_16", pos1),
        (val_add, ":var_14", 20),
        (position_set_x, pos1, 130),
        (position_set_y, pos1, ":var_14"),
        (val_add, ":var_14", -20),
        (overlay_set_position, "$g_presentation_obj_battle_17", pos1),
        (overlay_add_item, "$g_presentation_obj_battle_11", "@Dismount"),
        (overlay_add_item, "$g_presentation_obj_battle_11", "@Mount"),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 600),
        (overlay_set_size, "$g_presentation_obj_battle_11", pos1),
        (position_set_x, pos1, 350),
        (position_set_y, pos1, ":var_14"),
        (overlay_set_position, "$g_presentation_obj_battle_11", pos1),
        (overlay_set_alpha, "$g_presentation_obj_battle_11", 96),
        (overlay_set_val, "$g_presentation_obj_battle_11", "$g_latest_order_2"),
        (overlay_add_item, "$g_presentation_obj_battle_12", "@Fire At Will"),
        (overlay_add_item, "$g_presentation_obj_battle_12", "@Hold Your Fire"),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 600),
        (overlay_set_size, "$g_presentation_obj_battle_12", pos1),
        (position_set_x, pos1, 495),
        (position_set_y, pos1, ":var_14"),
        (overlay_set_position, "$g_presentation_obj_battle_12", pos1),
        (overlay_set_alpha, "$g_presentation_obj_battle_12", 96),
        (overlay_set_val, "$g_presentation_obj_battle_12", "$g_latest_order_3"),
        (overlay_add_item, "$g_presentation_obj_battle_13", "@Use Blunt Weapons"),
        (overlay_add_item, "$g_presentation_obj_battle_13", "@Use Any Weapon"),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 600),
        (overlay_set_size, "$g_presentation_obj_battle_13", pos1),
        (val_add, ":var_14", -35),
        (position_set_x, pos1, 495),
        (position_set_y, pos1, ":var_14"),
        (val_add, ":var_14", 35),
        (overlay_set_position, "$g_presentation_obj_battle_13", pos1),
        (overlay_set_alpha, "$g_presentation_obj_battle_13", 96),
        (overlay_set_val, "$g_presentation_obj_battle_13", "$g_latest_order_4"),
        (create_text_overlay, "$g_presentation_obj_battle_22", "str_us_", 0),
        (create_text_overlay, "$g_presentation_obj_battle_23", "str_allies_", 0),
        (create_text_overlay, "$g_presentation_obj_battle_24", "str_enemies_", 0),
        (create_text_overlay, "$g_presentation_obj_battle_25", "@Ready", 16),
        (create_text_overlay, "$g_presentation_obj_battle_26", "@Wounded", 16),
        (create_text_overlay, "$g_presentation_obj_battle_28", "str_routed", 16),
        (create_text_overlay, "$g_presentation_obj_battle_27", "@Dead", 16),
        (create_text_overlay, "$g_battle_us_ready", 7, 16),
        (create_text_overlay, "$g_battle_us_wounded", 7, 16),
        (create_text_overlay, "$g_battle_us_routed", 7, 16),
        (create_text_overlay, "$g_battle_us_dead", 7, 16),
        (create_text_overlay, "$g_battle_enemies_ready", 7, 16),
        (create_text_overlay, "$g_battle_enemies_wounded", 7, 16),
        (create_text_overlay, "$g_battle_enemies_routed", 7, 16),
        (create_text_overlay, "$g_battle_enemies_dead", 7, 16),
        (create_text_overlay, "$g_battle_allies_ready", 7, 16),
        (create_text_overlay, "$g_battle_allies_wounded", 7, 16),
        (create_text_overlay, "$g_battle_allies_routed", 7, 16),
        (create_text_overlay, "$g_battle_allies_dead", 7, 16),
        (create_image_button_overlay, "$g_battle_report_plane", "mesh_white_plane", "mesh_white_plane"),
        (overlay_set_color, "$g_battle_report_plane", 0),
        (position_set_x, pos1, 15500),
        (position_set_y, pos1, 6000),
        (overlay_set_size, "$g_battle_report_plane", pos1),
        (position_set_x, pos1, 672),
        (position_set_y, pos1, 275),
        (overlay_set_position, "$g_battle_report_plane", pos1),
        (overlay_set_alpha, "$g_battle_report_plane", 68),
        (overlay_set_color, "$g_battle_report_plane", 1140411),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, "$g_presentation_obj_battle_14", pos1),
        (overlay_set_size, "$g_presentation_obj_battle_15", pos1),
        (overlay_set_size, "$g_presentation_obj_battle_16", pos1),
        (overlay_set_size, "$g_presentation_obj_battle_17", pos1),
        (overlay_set_size, "$g_presentation_obj_battle_22", pos1),
        (overlay_set_size, "$g_presentation_obj_battle_23", pos1),
        (overlay_set_size, "$g_presentation_obj_battle_24", pos1),
        (overlay_set_size, "$g_presentation_obj_battle_25", pos1),
        (overlay_set_size, "$g_presentation_obj_battle_26", pos1),
        (overlay_set_size, "$g_presentation_obj_battle_27", pos1),
        (overlay_set_size, "$g_presentation_obj_battle_28", pos1),
        (overlay_set_size, "$g_battle_us_ready", pos1),
        (overlay_set_size, "$g_battle_us_wounded", pos1),
        (overlay_set_size, "$g_battle_us_routed", pos1),
        (overlay_set_size, "$g_battle_us_dead", pos1),
        (overlay_set_size, "$g_battle_enemies_ready", pos1),
        (overlay_set_size, "$g_battle_enemies_wounded", pos1),
        (overlay_set_size, "$g_battle_enemies_routed", pos1),
        (overlay_set_size, "$g_battle_enemies_dead", pos1),
        (overlay_set_size, "$g_battle_allies_ready", pos1),
        (overlay_set_size, "$g_battle_allies_wounded", pos1),
        (overlay_set_size, "$g_battle_allies_routed", pos1),
        (overlay_set_size, "$g_battle_allies_dead", pos1),
        (assign, ":var_7", 675),
        (assign, ":var_8", 280),
        (val_add, ":var_7", 70),
        (val_add, ":var_8", 90),
        (position_set_x, pos1, ":var_7"),
        (position_set_y, pos1, ":var_8"),
        (overlay_set_position, "$g_presentation_obj_battle_25", pos1),
        (val_add, ":var_7", 70),
        (position_set_x, pos1, ":var_7"),
        (overlay_set_position, "$g_presentation_obj_battle_26", pos1),
        (val_add, ":var_7", 70),
        (position_set_x, pos1, ":var_7"),
        (overlay_set_position, "$g_presentation_obj_battle_28", pos1),
        (val_add, ":var_7", 70),
        (position_set_x, pos1, ":var_7"),
        (overlay_set_position, "$g_presentation_obj_battle_27", pos1),
        (val_add, ":var_7", -280),
        (val_add, ":var_8", -30),
        (position_set_x, pos1, ":var_7"),
        (position_set_y, pos1, ":var_8"),
        (overlay_set_position, "$g_presentation_obj_battle_22", pos1),
        (val_add, ":var_8", -30),
        (position_set_y, pos1, ":var_8"),
        (overlay_set_position, "$g_presentation_obj_battle_23", pos1),
        (val_add, ":var_8", -30),
        (position_set_y, pos1, ":var_8"),
        (overlay_set_position, "$g_presentation_obj_battle_24", pos1),
        (get_scene_boundaries, pos2, pos3),
        (position_transform_position_to_local, pos4, pos2, pos3),
        (set_fixed_point_multiplier, 1000),
        (position_get_x, ":var_16", pos4),
        (position_get_y, ":var_17", pos4),
        (set_fixed_point_multiplier, 1000),
        (store_div, ":var_18", ":var_17", 100),
        (store_div, ":var_18", ":var_16", ":var_18"),
        (try_begin),
            (gt, ":var_18", 100),
            (assign, "$g_battle_map_width", 300),
            (store_div, "$g_battle_map_scale", ":var_16", "$g_battle_map_width"),
            (store_div, "$g_battle_map_height", ":var_17", "$g_battle_map_scale"),
        (else_try),
            (assign, "$g_battle_map_height", 300),
            (store_div, "$g_battle_map_scale", ":var_17", "$g_battle_map_height"),
            (store_div, "$g_battle_map_width", ":var_16", "$g_battle_map_scale"),
        (try_end),
        (scene_prop_get_num_instances, ":var_19", "spr_inventory"),
        (try_begin),
            (gt, ":var_19", 0),
            (create_mesh_overlay, reg1, "mesh_white_dot"),
            (position_set_x, pos1, 200),
            (position_set_y, pos1, 200),
            (overlay_set_size, reg1, pos1),
            (overlay_set_alpha, reg1, 255),
            (overlay_set_color, reg1, 16777215),
            (assign, ":var_20", reg1),
            (get_scene_boundaries, pos2, pos3),
            (scene_prop_get_instance, ":var_21", "spr_inventory", 0),
            (prop_instance_get_position, pos1, ":var_21"),
            (call_script, "script_convert_3d_pos_to_map_pos"),
            (overlay_set_position, ":var_20", pos0),
        (try_end),
        (create_image_button_overlay, "$g_battle_map_plane", "mesh_white_plane", "mesh_white_plane"),
        (overlay_set_color, "$g_battle_map_plane", 0),
        (store_add, ":var_22", "$g_battle_map_width", 20),
        (store_add, ":var_23", "$g_battle_map_height", 20),
        (store_mul, ":var_24", ":var_22", 50),
        (store_mul, ":var_25", ":var_23", 50),
        (position_set_x, pos1, ":var_24"),
        (position_set_y, pos1, ":var_25"),
        (overlay_set_size, "$g_battle_map_plane", pos1),
        (store_sub, ":var_26", 990, ":var_22"),
        (store_sub, ":var_27", 740, ":var_23"),
        (position_set_x, pos1, ":var_26"),
        (position_set_y, pos1, ":var_27"),
        (overlay_set_position, "$g_battle_map_plane", pos1),
        (overlay_set_alpha, "$g_battle_map_plane", 68),
        (create_mesh_overlay, "$g_battle_map_infantry_order_flag", "mesh_flag_infantry"),
        (create_mesh_overlay, "$g_battle_map_archers_order_flag", "mesh_flag_archers"),
        (create_mesh_overlay, "$g_battle_map_cavalry_order_flag", "mesh_flag_cavalry"),
        (overlay_set_alpha, "$g_battle_map_infantry_order_flag", 0),
        (overlay_set_alpha, "$g_battle_map_archers_order_flag", 0),
        (overlay_set_alpha, "$g_battle_map_cavalry_order_flag", 0),
        (call_script, "script_update_order_panel_checked_classes"),
        (call_script, "script_update_order_panel_statistics_and_map"),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":var_0"),
        (store_trigger_param_2, ":var_1"),
        (get_player_agent_no, ":var_2"),
        (agent_get_team, ":var_3", ":var_2"),
        (assign, ":var_4", 0),
        (try_begin),
            (eq, "$group0_has_troops", 1),
            (eq, ":var_0", "$g_presentation_obj_battle_check0"),
            (assign, ":var_4", 1),
            (assign, "$g_formation_group0_selected", ":var_1"),
            (try_begin),
                (eq, ":var_1", 1),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but0", 250, 68),
            (else_try),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but0", 250, 0),
            (try_end),
        (else_try),
            (eq, "$group1_has_troops", 1),
            (eq, ":var_0", "$g_presentation_obj_battle_check1"),
            (assign, ":var_4", 1),
            (assign, "$g_formation_group1_selected", ":var_1"),
            (try_begin),
                (eq, ":var_1", 1),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but1", 250, 68),
            (else_try),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but1", 250, 0),
            (try_end),
        (else_try),
            (eq, "$group2_has_troops", 1),
            (eq, ":var_0", "$g_presentation_obj_battle_check2"),
            (assign, ":var_4", 1),
            (assign, "$g_formation_group2_selected", ":var_1"),
            (try_begin),
                (eq, ":var_1", 1),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but2", 250, 68),
            (else_try),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but2", 250, 0),
            (try_end),
        (else_try),
            (eq, "$group3_has_troops", 1),
            (eq, ":var_0", "$g_presentation_obj_battle_check3"),
            (assign, ":var_4", 1),
            (assign, "$g_formation_group3_selected", ":var_1"),
            (try_begin),
                (eq, ":var_1", 1),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but3", 250, 68),
            (else_try),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but3", 250, 0),
            (try_end),
        (else_try),
            (eq, "$group4_has_troops", 1),
            (eq, ":var_0", "$g_presentation_obj_battle_check4"),
            (assign, ":var_4", 1),
            (assign, "$g_formation_group4_selected", ":var_1"),
            (try_begin),
                (eq, ":var_1", 1),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but4", 250, 68),
            (else_try),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but4", 250, 0),
            (try_end),
        (else_try),
            (eq, "$group5_has_troops", 1),
            (eq, ":var_0", "$g_presentation_obj_battle_check5"),
            (assign, ":var_4", 1),
            (assign, "$g_formation_group5_selected", ":var_1"),
            (try_begin),
                (eq, ":var_1", 1),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but5", 250, 68),
            (else_try),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but5", 250, 0),
            (try_end),
        (else_try),
            (eq, "$group6_has_troops", 1),
            (eq, ":var_0", "$g_presentation_obj_battle_check6"),
            (assign, ":var_4", 1),
            (assign, "$g_formation_group6_selected", ":var_1"),
            (try_begin),
                (eq, ":var_1", 1),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but6", 250, 68),
            (else_try),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but6", 250, 0),
            (try_end),
        (else_try),
            (eq, "$group7_has_troops", 1),
            (eq, ":var_0", "$g_presentation_obj_battle_check7"),
            (assign, ":var_4", 1),
            (assign, "$g_formation_group7_selected", ":var_1"),
            (try_begin),
                (eq, ":var_1", 1),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but7", 250, 68),
            (else_try),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but7", 250, 0),
            (try_end),
        (else_try),
            (eq, "$group8_has_troops", 1),
            (eq, ":var_0", "$g_presentation_obj_battle_check8"),
            (assign, ":var_4", 1),
            (assign, "$g_formation_group8_selected", ":var_1"),
            (try_begin),
                (eq, ":var_1", 1),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but8", 250, 68),
            (else_try),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but8", 250, 0),
            (try_end),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_battle_but0"),
            (assign, ":var_4", 1),
            (assign, "$g_formation_group0_selected", 1),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but0", 250, 68),
            (overlay_set_val, "$g_presentation_obj_battle_check0", 1),
            (try_begin),
                (eq, "$group1_has_troops", 1),
                (assign, "$g_formation_group1_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check1", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but1", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group2_has_troops", 1),
                (assign, "$g_formation_group2_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check2", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but2", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group3_has_troops", 1),
                (assign, "$g_formation_group3_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check3", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but3", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group4_has_troops", 1),
                (assign, "$g_formation_group4_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check4", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but4", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group5_has_troops", 1),
                (assign, "$g_formation_group5_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check5", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but5", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group6_has_troops", 1),
                (assign, "$g_formation_group6_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check6", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but6", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group7_has_troops", 1),
                (assign, "$g_formation_group7_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check7", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but7", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group8_has_troops", 1),
                (assign, "$g_formation_group8_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check8", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but8", 250, 0),
            (try_end),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_battle_but1"),
            (assign, ":var_4", 1),
            (assign, "$g_formation_group1_selected", 1),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but1", 250, 68),
            (overlay_set_val, "$g_presentation_obj_battle_check1", 1),
            (try_begin),
                (eq, "$group0_has_troops", 1),
                (assign, "$g_formation_group0_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check0", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but0", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group2_has_troops", 1),
                (assign, "$g_formation_group2_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check2", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but2", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group3_has_troops", 1),
                (assign, "$g_formation_group3_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check3", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but3", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group4_has_troops", 1),
                (assign, "$g_formation_group4_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check4", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but4", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group5_has_troops", 1),
                (assign, "$g_formation_group5_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check5", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but5", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group6_has_troops", 1),
                (assign, "$g_formation_group6_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check6", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but6", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group7_has_troops", 1),
                (assign, "$g_formation_group7_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check7", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but7", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group8_has_troops", 1),
                (assign, "$g_formation_group8_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check8", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but8", 250, 0),
            (try_end),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_battle_but2"),
            (assign, ":var_4", 1),
            (assign, "$g_formation_group2_selected", 1),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but2", 250, 68),
            (overlay_set_val, "$g_presentation_obj_battle_check2", 1),
            (try_begin),
                (eq, "$group0_has_troops", 1),
                (assign, "$g_formation_group0_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check0", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but0", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group1_has_troops", 1),
                (assign, "$g_formation_group1_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check1", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but1", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group3_has_troops", 1),
                (assign, "$g_formation_group3_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check3", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but3", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group4_has_troops", 1),
                (assign, "$g_formation_group4_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check4", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but4", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group5_has_troops", 1),
                (assign, "$g_formation_group5_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check5", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but5", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group6_has_troops", 1),
                (assign, "$g_formation_group6_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check6", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but6", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group7_has_troops", 1),
                (assign, "$g_formation_group7_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check7", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but7", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group8_has_troops", 1),
                (assign, "$g_formation_group8_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check8", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but8", 250, 0),
            (try_end),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_battle_but3"),
            (assign, ":var_4", 1),
            (assign, "$g_formation_group3_selected", 1),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but3", 250, 68),
            (overlay_set_val, "$g_presentation_obj_battle_check3", 1),
            (try_begin),
                (eq, "$group0_has_troops", 1),
                (assign, "$g_formation_group0_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check0", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but0", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group1_has_troops", 1),
                (assign, "$g_formation_group1_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check1", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but1", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group2_has_troops", 1),
                (assign, "$g_formation_group2_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check2", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but2", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group4_has_troops", 1),
                (assign, "$g_formation_group4_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check4", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but4", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group5_has_troops", 1),
                (assign, "$g_formation_group5_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check5", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but5", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group6_has_troops", 1),
                (assign, "$g_formation_group6_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check6", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but6", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group7_has_troops", 1),
                (assign, "$g_formation_group7_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check7", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but7", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group8_has_troops", 1),
                (assign, "$g_formation_group8_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check8", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but8", 250, 0),
            (try_end),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_battle_but4"),
            (assign, ":var_4", 1),
            (assign, "$g_formation_group4_selected", 1),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but4", 250, 68),
            (overlay_set_val, "$g_presentation_obj_battle_check4", 1),
            (try_begin),
                (eq, "$group0_has_troops", 1),
                (assign, "$g_formation_group0_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check0", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but0", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group1_has_troops", 1),
                (assign, "$g_formation_group1_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check1", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but1", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group2_has_troops", 1),
                (assign, "$g_formation_group2_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check2", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but2", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group3_has_troops", 1),
                (assign, "$g_formation_group3_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check3", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but3", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group5_has_troops", 1),
                (assign, "$g_formation_group5_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check5", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but5", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group6_has_troops", 1),
                (assign, "$g_formation_group6_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check6", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but6", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group7_has_troops", 1),
                (assign, "$g_formation_group7_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check7", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but7", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group8_has_troops", 1),
                (assign, "$g_formation_group8_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check8", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but8", 250, 0),
            (try_end),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_battle_but5"),
            (assign, ":var_4", 1),
            (assign, "$g_formation_group5_selected", 1),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but5", 250, 68),
            (overlay_set_val, "$g_presentation_obj_battle_check5", 1),
            (try_begin),
                (eq, "$group0_has_troops", 1),
                (assign, "$g_formation_group0_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check0", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but0", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group1_has_troops", 1),
                (assign, "$g_formation_group1_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check1", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but1", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group2_has_troops", 1),
                (assign, "$g_formation_group2_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check2", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but2", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group3_has_troops", 1),
                (assign, "$g_formation_group3_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check3", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but3", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group4_has_troops", 1),
                (assign, "$g_formation_group4_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check4", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but4", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group6_has_troops", 1),
                (assign, "$g_formation_group6_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check6", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but6", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group7_has_troops", 1),
                (assign, "$g_formation_group7_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check7", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but7", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group8_has_troops", 1),
                (assign, "$g_formation_group8_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check8", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but8", 250, 0),
            (try_end),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_battle_but6"),
            (assign, ":var_4", 1),
            (assign, "$g_formation_group6_selected", 1),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but6", 250, 68),
            (overlay_set_val, "$g_presentation_obj_battle_check6", 1),
            (try_begin),
                (eq, "$group0_has_troops", 1),
                (assign, "$g_formation_group0_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check0", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but0", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group1_has_troops", 1),
                (assign, "$g_formation_group1_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check1", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but1", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group2_has_troops", 1),
                (assign, "$g_formation_group2_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check2", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but2", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group3_has_troops", 1),
                (assign, "$g_formation_group3_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check3", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but3", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group4_has_troops", 1),
                (assign, "$g_formation_group4_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check4", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but4", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group5_has_troops", 1),
                (assign, "$g_formation_group5_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check5", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but5", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group7_has_troops", 1),
                (assign, "$g_formation_group7_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check7", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but7", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group8_has_troops", 1),
                (assign, "$g_formation_group8_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check8", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but8", 250, 0),
            (try_end),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_battle_but7"),
            (assign, ":var_4", 1),
            (assign, "$g_formation_group7_selected", 1),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but7", 250, 68),
            (overlay_set_val, "$g_presentation_obj_battle_check7", 1),
            (try_begin),
                (eq, "$group0_has_troops", 1),
                (assign, "$g_formation_group0_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check0", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but0", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group1_has_troops", 1),
                (assign, "$g_formation_group1_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check1", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but1", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group2_has_troops", 1),
                (assign, "$g_formation_group2_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check2", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but2", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group3_has_troops", 1),
                (assign, "$g_formation_group3_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check3", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but3", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group4_has_troops", 1),
                (assign, "$g_formation_group4_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check4", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but4", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group5_has_troops", 1),
                (assign, "$g_formation_group5_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check5", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but5", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group6_has_troops", 1),
                (assign, "$g_formation_group6_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check6", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but6", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group8_has_troops", 1),
                (assign, "$g_formation_group8_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check8", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but8", 250, 0),
            (try_end),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_battle_but8"),
            (assign, ":var_4", 1),
            (assign, "$g_formation_group8_selected", 1),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but8", 250, 68),
            (overlay_set_val, "$g_presentation_obj_battle_check8", 1),
            (try_begin),
                (eq, "$group0_has_troops", 1),
                (assign, "$g_formation_group0_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check0", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but0", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group1_has_troops", 1),
                (assign, "$g_formation_group1_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check1", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but1", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group2_has_troops", 1),
                (assign, "$g_formation_group2_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check2", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but2", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group3_has_troops", 1),
                (assign, "$g_formation_group3_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check3", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but3", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group4_has_troops", 1),
                (assign, "$g_formation_group4_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check4", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but4", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group5_has_troops", 1),
                (assign, "$g_formation_group5_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check5", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but5", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group6_has_troops", 1),
                (assign, "$g_formation_group6_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check6", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but6", 250, 0),
            (try_end),
            (try_begin),
                (eq, "$group7_has_troops", 1),
                (assign, "$g_formation_group7_selected", 0),
                (overlay_set_val, "$g_presentation_obj_battle_check7", 0),
                (overlay_animate_to_alpha, "$g_presentation_obj_battle_but7", 250, 0),
            (try_end),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_battle_14"),
            (call_script, "script_team_give_order_from_order_panel", ":var_2", 8),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_battle_15"),
            (call_script, "script_team_give_order_from_order_panel", ":var_2", 7),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_battle_16"),
            (call_script, "script_team_give_order_from_order_panel", ":var_2", 6),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_battle_17"),
            (call_script, "script_team_give_order_from_order_panel", ":var_2", 5),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_battle_10"),
            (try_begin),
                (eq, ":var_1", 3),
                (call_script, "script_team_give_order_from_order_panel", ":var_2", 0),
                (call_script, "script_update_order_panel", ":var_3"),
                (assign, "$g_latest_order_1", 3),
            (else_try),
                (eq, ":var_1", 2),
                (call_script, "script_team_give_order_from_order_panel", ":var_2", 1),
                (call_script, "script_update_order_panel", ":var_3"),
                (assign, "$g_latest_order_1", 2),
            (else_try),
                (eq, ":var_1", 1),
                (call_script, "script_team_give_order_from_order_panel", ":var_2", 2),
                (call_script, "script_update_order_panel", ":var_3"),
                (assign, "$g_latest_order_1", 1),
            (else_try),
                (eq, ":var_1", 0),
                (call_script, "script_team_give_order_from_order_panel", ":var_2", 11),
                (call_script, "script_update_order_panel", ":var_3"),
                (assign, "$g_latest_order_1", 0),
            (try_end),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_battle_11"),
            (try_begin),
                (eq, ":var_1", 1),
                (call_script, "script_team_give_order_from_order_panel", ":var_2", 3),
                (call_script, "script_update_order_panel", ":var_3"),
                (assign, "$g_latest_order_2", 1),
            (else_try),
                (eq, ":var_1", 0),
                (call_script, "script_team_give_order_from_order_panel", ":var_2", 4),
                (call_script, "script_update_order_panel", ":var_3"),
                (assign, "$g_latest_order_2", 0),
            (try_end),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_battle_12"),
            (try_begin),
                (eq, ":var_1", 1),
                (call_script, "script_team_give_order_from_order_panel", ":var_2", 12),
                (call_script, "script_update_order_panel", ":var_3"),
                (assign, "$g_latest_order_3", 1),
            (else_try),
                (eq, ":var_1", 0),
                (call_script, "script_team_give_order_from_order_panel", ":var_2", 13),
                (call_script, "script_update_order_panel", ":var_3"),
                (assign, "$g_latest_order_3", 0),
            (try_end),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_battle_13"),
            (try_begin),
                (eq, ":var_1", 1),
                (call_script, "script_team_give_order_from_order_panel", ":var_2", 10),
                (call_script, "script_update_order_panel", ":var_3"),
                (assign, "$g_latest_order_4", 1),
            (else_try),
                (eq, ":var_1", 0),
                (call_script, "script_team_give_order_from_order_panel", ":var_2", 9),
                (call_script, "script_update_order_panel", ":var_3"),
                (assign, "$g_latest_order_4", 0),
            (try_end),
        (else_try),
            (eq, ":var_0", "$g_battle_map_plane"),
            (get_scene_boundaries, pos2, pos3),
            (mouse_get_position, pos1),
            (set_fixed_point_multiplier, 1000),
            (position_get_x, ":var_5", pos1),
            (position_get_y, ":var_6", pos1),
            (store_sub, ":var_7", 980, "$g_battle_map_width"),
            (store_sub, ":var_8", 730, "$g_battle_map_height"),
            (val_sub, ":var_5", ":var_7"),
            (val_sub, ":var_6", ":var_8"),
            (val_clamp, ":var_5", 0, "$g_battle_map_width"),
            (val_clamp, ":var_6", 0, "$g_battle_map_height"),
            (val_mul, ":var_5", "$g_battle_map_scale"),
            (val_mul, ":var_6", "$g_battle_map_scale"),
            (set_fixed_point_multiplier, 1000),
            (position_set_x, pos1, ":var_5"),
            (position_set_y, pos1, ":var_6"),
            (position_transform_position_to_parent, pos3, pos2, pos1),
            (try_begin),
                (eq, "$g_formation_group0_selected", 1),
                (team_give_order, ":var_3", 0, 0),
                (team_set_order_position, ":var_3", 0, pos3),
            (try_end),
            (try_begin),
                (eq, "$g_formation_group1_selected", 1),
                (team_give_order, ":var_3", 1, 0),
                (team_set_order_position, ":var_3", 1, pos3),
            (try_end),
            (try_begin),
                (eq, "$g_formation_group2_selected", 1),
                (team_give_order, ":var_3", 2, 0),
                (team_set_order_position, ":var_3", 2, pos3),
            (try_end),
            (try_begin),
                (eq, "$g_formation_group3_selected", 1),
                (team_give_order, ":var_3", 3, 0),
                (team_set_order_position, ":var_3", 3, pos3),
            (try_end),
            (try_begin),
                (eq, "$g_formation_group4_selected", 1),
                (team_give_order, ":var_3", 4, 0),
                (team_set_order_position, ":var_3", 4, pos3),
            (try_end),
            (try_begin),
                (eq, "$g_formation_group5_selected", 1),
                (team_give_order, ":var_3", 5, 0),
                (team_set_order_position, ":var_3", 5, pos3),
            (try_end),
            (try_begin),
                (eq, "$g_formation_group6_selected", 1),
                (team_give_order, ":var_3", 6, 0),
                (team_set_order_position, ":var_3", 6, pos3),
            (try_end),
            (try_begin),
                (eq, "$g_formation_group7_selected", 1),
                (team_give_order, ":var_3", 7, 0),
                (team_set_order_position, ":var_3", 7, pos3),
            (try_end),
            (try_begin),
                (eq, "$g_formation_group8_selected", 1),
                (team_give_order, ":var_3", 8, 0),
                (team_set_order_position, ":var_3", 8, pos3),
            (try_end),
            (try_begin),
                (eq, "$g_option_formations", 1),
                (eq, "$g_disciplined_faction", 1),
                (assign, ":var_9", 1),
                (convert_to_fixed_point, ":var_9"),
                (set_fixed_point_multiplier, 100),
                (call_script, "script_team_get_average_position_of_enemies_augmented", 60, "$fplayer_team_no", 9),
                (call_script, "script_point_y_toward_position", 3, 60),
                (try_begin),
                    (eq, "$g_formation_group0_selected", 1),
                    (neg|eq, "$infantry_formation_type", 0),
                    (assign, ":var_10", 0),
                    (try_for_agents, reg0),
                        (call_script, "script_cf_valid_formation_member", "$fplayer_team_no", 0, "$fplayer_agent_no", reg0),
                        (val_add, ":var_10", 1),
                    (try_end),
                    (call_script, "script_get_centering_amount", "$infantry_formation_type", ":var_10", "$infantry_space"),
                    (copy_position, pos1, pos3),
                    (position_move_x, pos1, reg0),
                    (call_script, "script_set_formation_position", "$fplayer_team_no", 0, 1),
                    (call_script, "script_form_infantry", "$fplayer_team_no", "$fplayer_agent_no", "$infantry_space", "$infantry_formation_type"),
                    (assign, "$infantry_formation_move_order", 0),
                (try_end),
                (try_begin),
                    (eq, "$g_formation_group1_selected", 1),
                    (neg|eq, "$archer_formation_type", 0),
                    (assign, ":var_10", 0),
                    (try_for_agents, reg0),
                        (call_script, "script_cf_valid_formation_member", "$fplayer_team_no", 1, "$fplayer_agent_no", reg0),
                        (val_add, ":var_10", 1),
                    (try_end),
                    (call_script, "script_get_centering_amount", 1, ":var_10", "$archer_space"),
                    (val_mul, reg0, -1),
                    (copy_position, pos1, pos3),
                    (position_move_x, pos1, reg0),
                    (call_script, "script_set_formation_position", "$fplayer_team_no", 1, 1),
                    (call_script, "script_form_archers", "$fplayer_team_no", "$fplayer_agent_no", "$archer_space", "$archer_formation_type"),
                    (assign, "$archer_formation_move_order", 0),
                (try_end),
                (try_begin),
                    (eq, "$g_formation_group2_selected", 1),
                    (neg|eq, "$cavalry_formation_type", 0),
                    (copy_position, pos1, pos3),
                    (call_script, "script_set_formation_position", "$fplayer_team_no", 2, 1),
                    (call_script, "script_form_cavalry", "$fplayer_team_no", "$fplayer_agent_no", "$cavalry_space"),
                    (assign, "$cavalry_formation_move_order", 0),
                (try_end),
                (set_fixed_point_multiplier, ":var_9"),
            (try_end),
            (call_script, "script_update_order_flags_on_map"),
            (call_script, "script_update_order_panel", ":var_3"),
        (try_end),
        (try_begin),
            (eq, ":var_4", 1),
            (team_set_order_listener, ":var_3", -1),
            (try_begin),
                (this_or_next|eq, "$g_formation_group0_selected", 1),
                (eq, "$group0_has_troops", 0),
                (this_or_next|eq, "$g_formation_group1_selected", 1),
                (eq, "$group1_has_troops", 0),
                (this_or_next|eq, "$g_formation_group2_selected", 1),
                (eq, "$group2_has_troops", 0),
                (this_or_next|eq, "$g_formation_group3_selected", 1),
                (eq, "$group3_has_troops", 0),
                (this_or_next|eq, "$g_formation_group4_selected", 1),
                (eq, "$group4_has_troops", 0),
                (this_or_next|eq, "$g_formation_group5_selected", 1),
                (eq, "$group5_has_troops", 0),
                (this_or_next|eq, "$g_formation_group6_selected", 1),
                (eq, "$group6_has_troops", 0),
                (this_or_next|eq, "$g_formation_group7_selected", 1),
                (eq, "$group7_has_troops", 0),
                (this_or_next|eq, "$g_formation_group8_selected", 1),
                (eq, "$group8_has_troops", 0),
                (team_set_order_listener, ":var_3", 9),
            (else_try),
                (eq, "$g_formation_group0_selected", 1),
                (team_set_order_listener, ":var_3", 0, 1),
            (else_try),
                (eq, "$g_formation_group1_selected", 1),
                (team_set_order_listener, ":var_3", 1, 1),
            (else_try),
                (eq, "$g_formation_group2_selected", 1),
                (team_set_order_listener, ":var_3", 2, 1),
            (else_try),
                (eq, "$g_formation_group3_selected", 1),
                (team_set_order_listener, ":var_3", 3, 1),
            (else_try),
                (eq, "$g_formation_group4_selected", 1),
                (team_set_order_listener, ":var_3", 4, 1),
            (else_try),
                (eq, "$g_formation_group5_selected", 1),
                (team_set_order_listener, ":var_3", 5, 1),
            (else_try),
                (eq, "$g_formation_group6_selected", 1),
                (team_set_order_listener, ":var_3", 6, 1),
            (else_try),
                (eq, "$g_formation_group7_selected", 1),
                (team_set_order_listener, ":var_3", 7, 1),
            (else_try),
                (eq, "$g_formation_group8_selected", 1),
                (team_set_order_listener, ":var_3", 8, 1),
            (try_end),
        (try_end),
    ]),
    (ti_on_presentation_mouse_enter_leave, [
        (store_trigger_param_1, ":var_0"),
        (store_trigger_param_2, ":var_1"),
        (try_begin),
            (eq, ":var_0", "$g_presentation_obj_battle_but0"),
            (try_begin),
                (eq, ":var_1", 0),
                (overlay_animate_to_color, "$g_presentation_but0_movement", 250, 16777215),
                (overlay_animate_to_color, "$g_presentation_but0_riding", 250, 16777215),
                (overlay_animate_to_color, "$g_presentation_but0_weapon_usage", 250, 16777215),
                (overlay_animate_to_color, "$g_presentation_obj_battle_name0", 250, 16777215),
            (else_try),
                (overlay_animate_to_color, "$g_presentation_but0_movement", 250, 0),
                (overlay_animate_to_color, "$g_presentation_but0_riding", 250, 0),
                (overlay_animate_to_color, "$g_presentation_but0_weapon_usage", 250, 0),
                (overlay_animate_to_color, "$g_presentation_obj_battle_name0", 250, 0),
            (try_end),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_battle_but1"),
            (try_begin),
                (eq, ":var_1", 0),
                (overlay_animate_to_color, "$g_presentation_but1_movement", 250, 16777215),
                (overlay_animate_to_color, "$g_presentation_but1_riding", 250, 16777215),
                (overlay_animate_to_color, "$g_presentation_but1_weapon_usage", 250, 16777215),
                (overlay_animate_to_color, "$g_presentation_obj_battle_name1", 250, 16777215),
            (else_try),
                (overlay_animate_to_color, "$g_presentation_but1_movement", 250, 0),
                (overlay_animate_to_color, "$g_presentation_but1_riding", 250, 0),
                (overlay_animate_to_color, "$g_presentation_but1_weapon_usage", 250, 0),
                (overlay_animate_to_color, "$g_presentation_obj_battle_name1", 250, 0),
            (try_end),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_battle_but2"),
            (try_begin),
                (eq, ":var_1", 0),
                (overlay_animate_to_color, "$g_presentation_but2_movement", 250, 16777215),
                (overlay_animate_to_color, "$g_presentation_but2_riding", 250, 16777215),
                (overlay_animate_to_color, "$g_presentation_but2_weapon_usage", 250, 16777215),
                (overlay_animate_to_color, "$g_presentation_obj_battle_name2", 250, 16777215),
            (else_try),
                (overlay_animate_to_color, "$g_presentation_but2_movement", 250, 0),
                (overlay_animate_to_color, "$g_presentation_but2_riding", 250, 0),
                (overlay_animate_to_color, "$g_presentation_but2_weapon_usage", 250, 0),
                (overlay_animate_to_color, "$g_presentation_obj_battle_name2", 250, 0),
            (try_end),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_battle_but3"),
            (try_begin),
                (eq, ":var_1", 0),
                (overlay_animate_to_color, "$g_presentation_but3_movement", 250, 16777215),
                (overlay_animate_to_color, "$g_presentation_but3_riding", 250, 16777215),
                (overlay_animate_to_color, "$g_presentation_but3_weapon_usage", 250, 16777215),
                (overlay_animate_to_color, "$g_presentation_obj_battle_name3", 250, 16777215),
            (else_try),
                (overlay_animate_to_color, "$g_presentation_but3_movement", 250, 0),
                (overlay_animate_to_color, "$g_presentation_but3_riding", 250, 0),
                (overlay_animate_to_color, "$g_presentation_but3_weapon_usage", 250, 0),
                (overlay_animate_to_color, "$g_presentation_obj_battle_name3", 250, 0),
            (try_end),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_battle_but4"),
            (try_begin),
                (eq, ":var_1", 0),
                (overlay_animate_to_color, "$g_presentation_but4_movement", 250, 16777215),
                (overlay_animate_to_color, "$g_presentation_but4_riding", 250, 16777215),
                (overlay_animate_to_color, "$g_presentation_but4_weapon_usage", 250, 16777215),
                (overlay_animate_to_color, "$g_presentation_obj_battle_name4", 250, 16777215),
            (else_try),
                (overlay_animate_to_color, "$g_presentation_but4_movement", 250, 0),
                (overlay_animate_to_color, "$g_presentation_but4_riding", 250, 0),
                (overlay_animate_to_color, "$g_presentation_but4_weapon_usage", 250, 0),
                (overlay_animate_to_color, "$g_presentation_obj_battle_name4", 250, 0),
            (try_end),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_battle_but5"),
            (try_begin),
                (eq, ":var_1", 0),
                (overlay_animate_to_color, "$g_presentation_but5_movement", 250, 16777215),
                (overlay_animate_to_color, "$g_presentation_but5_riding", 250, 16777215),
                (overlay_animate_to_color, "$g_presentation_but5_weapon_usage", 250, 16777215),
                (overlay_animate_to_color, "$g_presentation_obj_battle_name5", 250, 16777215),
            (else_try),
                (overlay_animate_to_color, "$g_presentation_but5_movement", 250, 0),
                (overlay_animate_to_color, "$g_presentation_but5_riding", 250, 0),
                (overlay_animate_to_color, "$g_presentation_but5_weapon_usage", 250, 0),
                (overlay_animate_to_color, "$g_presentation_obj_battle_name5", 250, 0),
            (try_end),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_battle_but6"),
            (try_begin),
                (eq, ":var_1", 0),
                (overlay_animate_to_color, "$g_presentation_but6_movement", 250, 16777215),
                (overlay_animate_to_color, "$g_presentation_but6_riding", 250, 16777215),
                (overlay_animate_to_color, "$g_presentation_but6_weapon_usage", 250, 16777215),
                (overlay_animate_to_color, "$g_presentation_obj_battle_name6", 250, 16777215),
            (else_try),
                (overlay_animate_to_color, "$g_presentation_but6_movement", 250, 0),
                (overlay_animate_to_color, "$g_presentation_but6_riding", 250, 0),
                (overlay_animate_to_color, "$g_presentation_but6_weapon_usage", 250, 0),
                (overlay_animate_to_color, "$g_presentation_obj_battle_name6", 250, 0),
            (try_end),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_battle_but7"),
            (try_begin),
                (eq, ":var_1", 0),
                (overlay_animate_to_color, "$g_presentation_but7_movement", 250, 16777215),
                (overlay_animate_to_color, "$g_presentation_but7_riding", 250, 16777215),
                (overlay_animate_to_color, "$g_presentation_but7_weapon_usage", 250, 16777215),
                (overlay_animate_to_color, "$g_presentation_obj_battle_name7", 250, 16777215),
            (else_try),
                (overlay_animate_to_color, "$g_presentation_but7_movement", 250, 0),
                (overlay_animate_to_color, "$g_presentation_but7_riding", 250, 0),
                (overlay_animate_to_color, "$g_presentation_but7_weapon_usage", 250, 0),
                (overlay_animate_to_color, "$g_presentation_obj_battle_name7", 250, 0),
            (try_end),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_battle_but8"),
            (try_begin),
                (eq, ":var_1", 0),
                (overlay_animate_to_color, "$g_presentation_but8_movement", 250, 16777215),
                (overlay_animate_to_color, "$g_presentation_but8_riding", 250, 16777215),
                (overlay_animate_to_color, "$g_presentation_but8_weapon_usage", 250, 16777215),
                (overlay_animate_to_color, "$g_presentation_obj_battle_name8", 250, 16777215),
            (else_try),
                (overlay_animate_to_color, "$g_presentation_but8_movement", 250, 0),
                (overlay_animate_to_color, "$g_presentation_but8_riding", 250, 0),
                (overlay_animate_to_color, "$g_presentation_but8_weapon_usage", 250, 0),
                (overlay_animate_to_color, "$g_presentation_obj_battle_name8", 250, 0),
            (try_end),
        (try_end),
    ]),
    (ti_on_presentation_run, [
        (store_trigger_param_1, ":var_0"),
        (try_begin),
            (this_or_next|game_key_clicked, gk_infantry_hear),
            (this_or_next|game_key_clicked, gk_archers_hear),
            (this_or_next|game_key_clicked, gk_cavalry_hear),
            (this_or_next|game_key_clicked, gk_group3_hear),
            (this_or_next|game_key_clicked, gk_group4_hear),
            (this_or_next|game_key_clicked, gk_group5_hear),
            (this_or_next|game_key_clicked, gk_group6_hear),
            (this_or_next|game_key_clicked, gk_group7_hear),
            (this_or_next|game_key_clicked, gk_group8_hear),
            (this_or_next|game_key_clicked, gk_everyone_hear),
            (game_key_clicked, gk_reverse_order_group),
            (call_script, "script_update_order_panel_checked_classes"),
        (try_end),
        (try_begin),
            (this_or_next|game_key_clicked, gk_order_1),
            (this_or_next|game_key_clicked, gk_order_2),
            (this_or_next|game_key_clicked, gk_order_3),
            (this_or_next|game_key_clicked, gk_order_4),
            (this_or_next|game_key_clicked, gk_order_5),
            (game_key_clicked, gk_order_6),
            (get_player_agent_no, ":var_1"),
            (agent_get_team, ":var_2", ":var_1"),
            (call_script, "script_update_order_panel", ":var_2"),
        (try_end),
        (try_begin),
            (gt, ":var_0", 200),
            (game_key_clicked, gk_view_orders),
            (try_for_agents, ":var_3"),
                (agent_set_slot, ":var_3", slot_agent_map_overlay_id, 0),
            (try_end),
            (presentation_set_duration, 0),
            (try_begin),
                (eq, "$g_option_show_killcount", 1),
                (start_presentation, "prsnt_killcount"),
            (try_end),
        (try_end),
    ]),
]),

("sliders", 0, 0, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (create_slider_overlay, "$g_presentation_obj_sliders_1", 0, 100),
        (create_slider_overlay, "$g_presentation_obj_sliders_2", 0, 100),
        (create_slider_overlay, "$g_presentation_obj_sliders_3", 0, 100),
        (create_slider_overlay, "$g_presentation_obj_sliders_4", 0, 100),
        (assign, reg1, 25),
        (str_store_string, s1, "str_reg1"),
        (create_text_overlay, "$g_presentation_obj_sliders_5", 1),
        (create_text_overlay, "$g_presentation_obj_sliders_6", 1),
        (create_text_overlay, "$g_presentation_obj_sliders_7", 1),
        (create_text_overlay, "$g_presentation_obj_sliders_8", 1),
        (assign, "$g_presentation_obj_sliders_1_val", 25),
        (overlay_set_val, "$g_presentation_obj_sliders_1", 25),
        (assign, "$g_presentation_obj_sliders_2_val", 25),
        (overlay_set_val, "$g_presentation_obj_sliders_2", 25),
        (assign, "$g_presentation_obj_sliders_3_val", 25),
        (overlay_set_val, "$g_presentation_obj_sliders_3", 25),
        (assign, "$g_presentation_obj_sliders_4_val", 25),
        (overlay_set_val, "$g_presentation_obj_sliders_4", 25),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 200),
        (overlay_set_position, "$g_presentation_obj_sliders_1", pos1),
        (position_set_y, pos1, 300),
        (overlay_set_position, "$g_presentation_obj_sliders_2", pos1),
        (position_set_y, pos1, 400),
        (overlay_set_position, "$g_presentation_obj_sliders_3", pos1),
        (position_set_y, pos1, 500),
        (overlay_set_position, "$g_presentation_obj_sliders_4", pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 200),
        (overlay_set_position, "$g_presentation_obj_sliders_5", pos1),
        (position_set_y, pos1, 300),
        (overlay_set_position, "$g_presentation_obj_sliders_6", pos1),
        (position_set_y, pos1, 400),
        (overlay_set_position, "$g_presentation_obj_sliders_7", pos1),
        (position_set_y, pos1, 500),
        (overlay_set_position, "$g_presentation_obj_sliders_8", pos1),
        (position_set_x, pos1, 500),
        (overlay_set_size, "$g_presentation_obj_sliders_3", pos1),
    ]),
    (ti_on_presentation_run, [
    ]),
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":var_0"),
        (store_trigger_param_2, ":var_1"),
        (assign, ":var_2", 0),
        (try_begin),
            (eq, ":var_0", "$g_presentation_obj_sliders_1"),
            (try_begin),
                (neg|eq, "$g_presentation_obj_sliders_1_val", ":var_1"),
                (assign, "$g_presentation_obj_sliders_1_val", ":var_1"),
                (assign, ":var_2", 1),
            (try_end),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_sliders_2"),
            (try_begin),
                (neg|eq, "$g_presentation_obj_sliders_2_val", ":var_1"),
                (assign, "$g_presentation_obj_sliders_2_val", ":var_1"),
                (assign, ":var_2", 1),
            (try_end),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_sliders_3"),
            (try_begin),
                (neg|eq, "$g_presentation_obj_sliders_3_val", ":var_1"),
                (assign, "$g_presentation_obj_sliders_3_val", ":var_1"),
                (assign, ":var_2", 1),
            (try_end),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_sliders_4"),
            (try_begin),
                (neg|eq, "$g_presentation_obj_sliders_4_val", ":var_1"),
                (assign, "$g_presentation_obj_sliders_4_val", ":var_1"),
                (assign, ":var_2", 1),
            (try_end),
        (try_end),
        (try_begin),
            (eq, ":var_2", 1),
            (assign, ":var_3", 0),
            (val_add, ":var_3", "$g_presentation_obj_sliders_1_val"),
            (val_add, ":var_3", "$g_presentation_obj_sliders_2_val"),
            (val_add, ":var_3", "$g_presentation_obj_sliders_3_val"),
            (val_add, ":var_3", "$g_presentation_obj_sliders_4_val"),
            (store_sub, ":var_4", 100, ":var_3"),
            (assign, ":var_5", "$g_presentation_obj_sliders_1_val"),
            (assign, ":var_6", "$g_presentation_obj_sliders_2_val"),
            (assign, ":var_7", "$g_presentation_obj_sliders_3_val"),
            (assign, ":var_8", "$g_presentation_obj_sliders_4_val"),
            (assign, ":var_9", 1),
            (assign, ":var_10", 0),
            (assign, ":var_11", 100),
            (try_begin),
                (neg|ge, ":var_4", 0),
                (val_mul, ":var_4", -1),
                (assign, ":var_9", -1),
                (assign, ":var_10", 1),
                (assign, ":var_11", 101),
            (try_end),
            (store_sub, ":var_12", ":var_3", ":var_1"),
            (val_add, ":var_12", 30),
            (try_for_range, ":var_13", 0, ":var_4"),
                (store_random_in_range, ":var_14", 0, ":var_12"),
                (try_begin),
                    (neg|eq, ":var_0", "$g_presentation_obj_sliders_1"),
                    (val_sub, ":var_14", "$g_presentation_obj_sliders_1_val"),
                    (val_sub, ":var_14", 10),
                    (neg|ge, ":var_14", 0),
                    (is_between, ":var_5", ":var_10", ":var_11"),
                    (val_add, ":var_5", ":var_9"),
                (else_try),
                    (neg|eq, ":var_0", "$g_presentation_obj_sliders_2"),
                    (val_sub, ":var_14", "$g_presentation_obj_sliders_2_val"),
                    (val_sub, ":var_14", 10),
                    (neg|ge, ":var_14", 0),
                    (is_between, ":var_6", ":var_10", ":var_11"),
                    (val_add, ":var_6", ":var_9"),
                (else_try),
                    (neg|eq, ":var_0", "$g_presentation_obj_sliders_3"),
                    (val_sub, ":var_14", "$g_presentation_obj_sliders_3_val"),
                    (val_sub, ":var_14", 10),
                    (neg|ge, ":var_14", 0),
                    (is_between, ":var_7", ":var_10", ":var_11"),
                    (val_add, ":var_7", ":var_9"),
                (else_try),
                    (is_between, ":var_8", ":var_10", ":var_11"),
                    (val_add, ":var_8", ":var_9"),
                (else_try),
                    (val_add, ":var_4", 1),
                (try_end),
            (try_end),
            (assign, "$g_presentation_obj_sliders_1_val", ":var_5"),
            (assign, "$g_presentation_obj_sliders_2_val", ":var_6"),
            (assign, "$g_presentation_obj_sliders_3_val", ":var_7"),
            (assign, "$g_presentation_obj_sliders_4_val", ":var_8"),
        (try_end),
        (overlay_set_val, "$g_presentation_obj_sliders_1", "$g_presentation_obj_sliders_1_val"),
        (overlay_set_val, "$g_presentation_obj_sliders_2", "$g_presentation_obj_sliders_2_val"),
        (overlay_set_val, "$g_presentation_obj_sliders_3", "$g_presentation_obj_sliders_3_val"),
        (overlay_set_val, "$g_presentation_obj_sliders_4", "$g_presentation_obj_sliders_4_val"),
        (assign, reg1, "$g_presentation_obj_sliders_1_val"),
        (str_store_string, s1, "str_reg1"),
        (overlay_set_text, "$g_presentation_obj_sliders_5", 1),
        (assign, reg1, "$g_presentation_obj_sliders_2_val"),
        (str_store_string, s1, "str_reg1"),
        (overlay_set_text, "$g_presentation_obj_sliders_6", 1),
        (assign, reg1, "$g_presentation_obj_sliders_3_val"),
        (str_store_string, s1, "str_reg1"),
        (overlay_set_text, "$g_presentation_obj_sliders_7", 1),
        (assign, reg1, "$g_presentation_obj_sliders_4_val"),
        (str_store_string, s1, "str_reg1"),
        (overlay_set_text, "$g_presentation_obj_sliders_8", 1),
    ]),
]),

("arena_training", prsntf_manual_end_only|prsntf_read_only, 0, [
    (ti_on_presentation_load, [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        (get_player_agent_no, ":var_0"),
        (agent_get_kill_count, reg1, ":var_0", 1),
        (str_store_string, s1, "@Number of men knocked down: {reg1}"),
        (create_text_overlay, "$g_presentation_obj_arena_training_1", 1),
        (overlay_set_color, "$g_presentation_obj_arena_training_1", 16777215),
        (position_set_x, pos1, 10),
        (position_set_y, pos1, 700),
        (overlay_set_position, "$g_presentation_obj_arena_training_1", pos1),
        (assign, reg1, 0),
        (str_store_string, s1, "@Number of men left: {reg1}"),
        (create_text_overlay, "$g_presentation_obj_arena_training_2", 1),
        (overlay_set_color, "$g_presentation_obj_arena_training_2", 16777215),
        (position_set_x, pos1, 10),
        (position_set_y, pos1, 670),
        (overlay_set_position, "$g_presentation_obj_arena_training_2", pos1),
    ]),
    (ti_on_presentation_run, [
        (get_player_agent_no, ":var_0"),
        (agent_get_kill_count, reg1, ":var_0", 1),
        (str_store_string, s1, "@Opponents Beaten: {reg1}"),
        (overlay_set_text, "$g_presentation_obj_arena_training_1", 1),
        (assign, ":var_1", "$g_arena_training_max_opponents"),
        (try_for_agents, ":var_2"),
            (agent_is_human, ":var_2"),
            (neg|agent_is_alive, ":var_2"),
            (neg|eq, ":var_2", ":var_0"),
            (val_sub, ":var_1", 1),
        (try_end),
        (assign, reg1, ":var_1"),
        (str_store_string, s1, "@Opponents Remaining: {reg1}"),
        (overlay_set_text, "$g_presentation_obj_arena_training_2", 1),
    ]),
]),

("killcount", prsntf_read_only, 0, [
    (ti_on_presentation_load, [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        (get_player_agent_no, ":var_0"),
        (agent_get_horse, ":var_1", ":var_0"),
        (troop_get_inventory_slot, ":var_2", "trp_player", 8),
        (try_begin),
            (ge, ":var_2", 0),
            (neg|is_between, "$g_encountered_party", "p_town_1", "p_village_1"),
            (neg|is_between, "$g_encountered_party_2", "p_town_1", "p_village_1"),
            (gt, "$g_encountered_party", 0),
            (gt, "$g_encountered_party_2", 0),
            (party_get_template_id, ":var_3", "$g_encountered_party"),
            (neg|is_between, ":var_3", "pt_steppe_bandit_lair", "pt_bandit_lair_templates_end"),
            (neg|ge, ":var_1", 0),
        (else_try),
            (assign, "$killcount_player_horse", ":var_1"),
        (try_end),
        (str_store_string, s1, "@Your kills: 0"),
        (create_text_overlay, "$g_presentation_obj_1", 1),
        (overlay_set_color, "$g_presentation_obj_1", 65280),
        (position_set_x, pos1, 10),
        (position_set_y, pos1, 700),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
    ]),
    (ti_on_presentation_run, [
        (try_begin),
            (game_key_clicked, gk_view_orders),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_battle"),
        (else_try),
            (get_player_agent_no, ":var_0"),
            (agent_get_kill_count, reg0, ":var_0"),
            (agent_get_kill_count, reg1, ":var_0", 1),
            (val_add, reg1, reg0),
            (try_begin),
                (gt, "$killcount_player_horse", 0),
                (agent_get_kill_count, reg0, "$killcount_player_horse", 1),
                (val_add, reg1, reg0),
            (try_end),
            (str_store_string, s1, "@Your kills: {reg1}"),
            (overlay_set_text, "$g_presentation_obj_1", 1),
        (try_end),
    ]),
]),

("retirement", 0, mesh_load_window, [
    (ti_on_presentation_load, [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        (create_button_overlay, "$g_presentation_obj_retirement_1", "@Remain in retirement.", 16),
        (create_button_overlay, "$g_presentation_obj_retirement_2", "@Go back to the adventuring.", 16),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 80),
        (overlay_set_position, "$g_presentation_obj_retirement_1", pos1),
        (position_set_y, pos1, 40),
        (overlay_set_position, "$g_presentation_obj_retirement_2", pos1),
        (assign, ":var_0", 0),
        (store_troop_gold, ":var_1", "trp_player"),
        (store_div, ":var_2", ":var_1", 200),
        (val_add, ":var_0", ":var_2"),
        (assign, ":var_3", 0),
        (assign, ":var_4", 0),
        (assign, ":var_5", 0),
        (assign, ":var_6", 0),
        (assign, ":var_7", 0),
        (assign, ":var_8", 0),
        (assign, ":var_9", 0),
        (try_for_range, ":var_10", "p_town_1", "p_salt_mine"),
            (party_get_slot, ":var_11", ":var_10", slot_party_type),
            (try_begin),
                (party_slot_eq, ":var_10", slot_town_lord, "trp_player"),
                (try_begin),
                    (eq, ":var_11", 3),
                    (val_add, ":var_3", 1),
                (else_try),
                    (eq, ":var_11", 2),
                    (val_add, ":var_4", 1),
                (else_try),
                    (val_add, ":var_5", 1),
                (try_end),
            (try_end),
            (party_get_slot, ":var_12", ":var_10", slot_center_player_relation),
            (try_begin),
                (ge, ":var_12", 40),
                (try_begin),
                    (eq, ":var_11", 3),
                    (val_add, ":var_6", 1),
                (else_try),
                    (eq, ":var_11", 4),
                    (val_add, ":var_7", 1),
                (try_end),
            (else_try),
                (neg|gt, ":var_12", -40),
                (try_begin),
                    (eq, ":var_11", 3),
                    (val_add, ":var_8", 1),
                (else_try),
                    (eq, ":var_11", 4),
                    (val_add, ":var_9", 1),
                (try_end),
            (try_end),
        (try_end),
        (store_mul, ":var_13", ":var_3", 100),
        (store_mul, ":var_14", ":var_4", 50),
        (store_mul, ":var_15", ":var_5", 20),
        (store_add, ":var_16", ":var_3", ":var_4"),
        (val_add, ":var_16", ":var_5"),
        (store_add, ":var_17", ":var_13", ":var_14"),
        (val_add, ":var_17", ":var_15"),
        (val_add, ":var_0", ":var_17"),
        (store_mul, ":var_18", ":var_6", 20),
        (store_mul, ":var_19", ":var_7", 4),
        (store_add, ":var_20", ":var_6", ":var_7"),
        (store_add, ":var_21", ":var_18", ":var_19"),
        (val_add, ":var_0", ":var_21"),
        (store_mul, ":var_22", ":var_8", -40),
        (store_mul, ":var_23", ":var_9", -8),
        (store_add, ":var_24", ":var_8", ":var_9"),
        (store_add, ":var_25", ":var_22", ":var_23"),
        (val_add, ":var_0", ":var_25"),
        (assign, ":var_26", 0),
        (troop_get_inventory_capacity, ":var_27", "trp_player"),
        (try_for_range, ":var_28", 0, ":var_27"),
            (troop_get_inventory_slot, ":var_29", "trp_player", ":var_28"),
            (ge, ":var_29", 0),
            (store_item_value, ":var_30", ":var_29"),
            (val_add, ":var_26", ":var_30"),
        (try_end),
        (store_div, ":var_31", ":var_26", 200),
        (val_add, ":var_0", ":var_31"),
        (troop_get_slot, ":var_32", "trp_player", slot_troop_renown),
        (store_div, ":var_33", ":var_32", 1),
        (val_add, ":var_0", ":var_33"),
        (assign, ":var_34", 0),
        (assign, ":var_35", 0),
        (try_for_range, ":var_36", "trp_npc_adonja", "trp_heroes_end"),
            (this_or_next|troop_slot_eq, ":var_36", slot_troop_occupation, 2),
            (troop_slot_eq, ":var_36", slot_troop_occupation, 6),
            (call_script, "script_troop_get_player_relation", ":var_36"),
            (assign, ":var_12", reg0),
            (try_begin),
                (ge, ":var_12", 40),
                (val_add, ":var_35", 1),
            (else_try),
                (neg|gt, ":var_12", -40),
                (val_add, ":var_34", 1),
            (try_end),
        (try_end),
        (store_mul, ":var_37", ":var_35", 10),
        (val_add, ":var_0", ":var_37"),
        (store_mul, ":var_38", ":var_34", -10),
        (val_add, ":var_0", ":var_38"),
        (store_current_day, ":var_39"),
        (store_div, ":var_40", ":var_39", -1),
        (val_add, ":var_0", ":var_40"),
        (store_mul, ":var_41", "$g_total_victories", 2),
        (val_add, ":var_0", ":var_41"),
        (store_mul, ":var_42", "$g_total_defeats", -3),
        (val_add, ":var_0", ":var_42"),
        (store_mul, ":var_43", "$g_total_quests_completed", 4),
        (val_add, ":var_0", ":var_43"),
        (troop_get_xp, ":var_44", "trp_player"),
        (store_div, ":var_45", ":var_44", 5000),
        (val_add, ":var_0", ":var_45"),
        (assign, ":var_46", 0),
        (assign, ":var_47", 0),
        (try_for_range, ":var_36", "trp_npc_adonja", "trp_kingdom_1_lord"),
            (try_begin),
                (troop_slot_eq, ":var_36", slot_troop_occupation, 5),
                (val_add, ":var_46", 1),
            (else_try),
                (troop_slot_ge, ":var_36", slot_troop_playerparty_history, 1),
                (val_add, ":var_47", 1),
            (try_end),
        (try_end),
        (store_div, ":var_48", ":var_46", 2),
        (val_add, ":var_0", ":var_48"),
        (store_div, ":var_49", ":var_47", -4),
        (val_add, ":var_0", ":var_49"),
        (get_average_game_difficulty, ":var_50"),
        (assign, ":var_51", ":var_0"),
        (val_mul, ":var_0", ":var_50"),
        (val_div, ":var_0", 75),
        (val_mul, ":var_0", ":var_50"),
        (val_div, ":var_0", 75),
        (store_sub, ":var_51", ":var_0", ":var_51"),
        (assign, reg5, ":var_39"),
        (store_character_level, reg4, "trp_player"),
        (create_text_overlay, reg1, "@You have retired at level {reg4} after {reg5} days of adventuring.", 16),
        (position_set_x, pos1, 700),
        (position_set_y, pos1, 700),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 950),
        (position_set_y, pos1, 950),
        (overlay_set_size, reg1, pos1),
        (create_text_overlay, reg2, "@Effect on Score", 16),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg2, pos1),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 670),
        (overlay_set_position, reg2, pos1),
        (assign, reg0, ":var_16"),
        (create_text_overlay, reg1, "@Settlements owned by you: {reg0}", 0),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 650),
        (overlay_set_position, reg1, pos1),
        (assign, reg0, ":var_17"),
        (create_text_overlay, reg1, "@{!}{reg0?+:}{reg0}", 16),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 650),
        (overlay_set_position, reg1, pos1),
        (try_begin),
            (gt, reg0, 0),
            (overlay_set_color, reg1, 43520),
        (try_end),
        (assign, reg0, ":var_20"),
        (create_text_overlay, reg1, "@Friendly Settlements: {reg0}", 0),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 630),
        (overlay_set_position, reg1, pos1),
        (assign, reg0, ":var_21"),
        (create_text_overlay, reg1, "@{!}{reg0?+:}{reg0}", 16),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 630),
        (overlay_set_position, reg1, pos1),
        (try_begin),
            (gt, reg0, 0),
            (overlay_set_color, reg1, 43520),
        (try_end),
        (assign, reg0, ":var_24"),
        (create_text_overlay, reg1, "@Hostile Settlements: {reg0}", 0),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 610),
        (overlay_set_position, reg1, pos1),
        (assign, reg0, ":var_25"),
        (create_text_overlay, reg1, "@{!}{reg0}", 16),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 610),
        (overlay_set_position, reg1, pos1),
        (try_begin),
            (neg|ge, reg0, 0),
            (overlay_set_color, reg1, 16711680),
        (try_end),
        (assign, reg0, ":var_35"),
        (create_text_overlay, reg1, "@Friendly Lords: {reg0}", 0),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 590),
        (overlay_set_position, reg1, pos1),
        (assign, reg0, ":var_37"),
        (create_text_overlay, reg1, "@{!}{reg0?+:}{reg0}", 16),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 590),
        (overlay_set_position, reg1, pos1),
        (try_begin),
            (gt, reg0, 0),
            (overlay_set_color, reg1, 43520),
        (try_end),
        (assign, reg0, ":var_34"),
        (create_text_overlay, reg1, "@Enemy Lords: {reg0}", 0),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 570),
        (overlay_set_position, reg1, pos1),
        (assign, reg0, ":var_38"),
        (create_text_overlay, reg1, "@{!}{reg0}", 16),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 570),
        (overlay_set_position, reg1, pos1),
        (try_begin),
            (neg|ge, reg0, 0),
            (overlay_set_color, reg1, 16711680),
        (try_end),
        (assign, reg0, "$g_total_victories"),
        (create_text_overlay, reg1, "@Victories: {reg0}", 0),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 550),
        (overlay_set_position, reg1, pos1),
        (assign, reg0, ":var_41"),
        (create_text_overlay, reg1, "@{!}{reg0?+:}{reg0}", 16),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 550),
        (overlay_set_position, reg1, pos1),
        (try_begin),
            (gt, reg0, 0),
            (overlay_set_color, reg1, 43520),
        (try_end),
        (assign, reg0, "$g_total_defeats"),
        (create_text_overlay, reg1, "@Defeats: {reg0}", 0),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 530),
        (overlay_set_position, reg1, pos1),
        (assign, reg0, ":var_42"),
        (create_text_overlay, reg1, "@{!}{reg0}", 16),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 530),
        (overlay_set_position, reg1, pos1),
        (try_begin),
            (neg|ge, reg0, 0),
            (overlay_set_color, reg1, 16711680),
        (try_end),
        (assign, reg0, "$g_total_quests_completed"),
        (create_text_overlay, reg1, "@Quests Completed: {reg0}", 0),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 510),
        (overlay_set_position, reg1, pos1),
        (assign, reg0, ":var_43"),
        (create_text_overlay, reg1, "@{!}{reg0?+:}{reg0}", 16),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 510),
        (overlay_set_position, reg1, pos1),
        (try_begin),
            (gt, reg0, 0),
            (overlay_set_color, reg1, 43520),
        (try_end),
        (assign, reg0, ":var_46"),
        (create_text_overlay, reg1, "@Companions Found: {reg0}", 0),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 490),
        (overlay_set_position, reg1, pos1),
        (assign, reg0, ":var_48"),
        (create_text_overlay, reg1, "@{!}{reg0?+:}{reg0}", 16),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 490),
        (overlay_set_position, reg1, pos1),
        (try_begin),
            (gt, reg0, 0),
            (overlay_set_color, reg1, 43520),
        (try_end),
        (assign, reg0, ":var_47"),
        (create_text_overlay, reg1, "@Companions Lost/Departed: {reg0}", 0),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 470),
        (overlay_set_position, reg1, pos1),
        (assign, reg0, ":var_49"),
        (create_text_overlay, reg1, "@{!}{reg0}", 16),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 470),
        (overlay_set_position, reg1, pos1),
        (try_begin),
            (neg|ge, reg0, 0),
            (overlay_set_color, reg1, 16711680),
        (try_end),
        (assign, reg0, ":var_1"),
        (create_text_overlay, reg1, "@Wealth: {reg0} denars", 0),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 450),
        (overlay_set_position, reg1, pos1),
        (assign, reg0, ":var_2"),
        (create_text_overlay, reg1, "@{!}{reg0?+:}{reg0}", 16),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 450),
        (overlay_set_position, reg1, pos1),
        (try_begin),
            (gt, reg0, 0),
            (overlay_set_color, reg1, 43520),
        (try_end),
        (assign, reg0, ":var_26"),
        (create_text_overlay, reg1, "@Inventory: {reg0} denars", 0),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 430),
        (overlay_set_position, reg1, pos1),
        (assign, reg0, ":var_31"),
        (create_text_overlay, reg1, "@{!}{reg0?+:}{reg0}", 16),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 430),
        (overlay_set_position, reg1, pos1),
        (try_begin),
            (gt, reg0, 0),
            (overlay_set_color, reg1, 43520),
        (try_end),
        (assign, reg0, ":var_32"),
        (create_text_overlay, reg1, "@Renown: {reg0}", 0),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 410),
        (overlay_set_position, reg1, pos1),
        (assign, reg0, ":var_33"),
        (create_text_overlay, reg1, "@{!}{reg0?+:}{reg0}", 16),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 410),
        (overlay_set_position, reg1, pos1),
        (try_begin),
            (gt, reg0, 0),
            (overlay_set_color, reg1, 43520),
        (try_end),
        (assign, reg0, ":var_44"),
        (create_text_overlay, reg1, "@Experience: {reg0}", 0),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 390),
        (overlay_set_position, reg1, pos1),
        (assign, reg0, ":var_45"),
        (create_text_overlay, reg1, "@{!}{reg0?+:}{reg0}", 16),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 390),
        (overlay_set_position, reg1, pos1),
        (try_begin),
            (gt, reg0, 0),
            (overlay_set_color, reg1, 43520),
        (try_end),
        (assign, reg0, ":var_39"),
        (create_text_overlay, reg1, "@Days Passed: {reg0}", 0),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 370),
        (overlay_set_position, reg1, pos1),
        (assign, reg0, ":var_40"),
        (create_text_overlay, reg1, "@{!}{reg0}", 16),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 370),
        (overlay_set_position, reg1, pos1),
        (try_begin),
            (neg|ge, reg0, 0),
            (overlay_set_color, reg1, 16711680),
        (try_end),
        (assign, reg0, ":var_50"),
        (create_text_overlay, reg1, "@Difficulty: {reg0}%", 0),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 350),
        (overlay_set_position, reg1, pos1),
        (assign, reg0, ":var_51"),
        (assign, reg3, reg0),
        (val_max, reg3, 0),
        (create_text_overlay, reg1, "@{!}{reg3?+:}{reg0}", 16),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 350),
        (overlay_set_position, reg1, pos1),
        (try_begin),
            (gt, reg0, 0),
            (overlay_set_color, reg1, 43520),
        (else_try),
            (neg|ge, reg0, 0),
            (overlay_set_color, reg1, 16711680),
        (try_end),
        (assign, reg0, ":var_0"),
        (create_text_overlay, reg1, "@TOTAL SCORE: {reg0}", 16),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 320),
        (overlay_set_position, reg1, pos1),
        (assign, ":var_52", 0),
        (assign, ":var_53", 0),
        (assign, ":var_54", 0),
        (assign, ":var_55", 0),
        (assign, ":var_56", 0),
        (assign, ":var_57", 0),
        (try_for_range, ":var_58", "p_town_1", "p_salt_mine"),
            (try_begin),
                (party_slot_eq, ":var_58", slot_town_lord, "trp_player"),
                (try_begin),
                    (party_slot_eq, ":var_58", slot_party_type, 3),
                    (val_add, ":var_54", 1),
                (else_try),
                    (party_slot_eq, ":var_58", slot_party_type, 2),
                    (val_add, ":var_53", 1),
                (else_try),
                    (val_add, ":var_52", 1),
                (try_end),
            (else_try),
                (party_get_slot, ":var_59", ":var_58", slot_center_player_relation),
                (gt, ":var_59", 0),
                (try_begin),
                    (party_slot_eq, ":var_58", slot_party_type, 3),
                    (val_add, ":var_57", ":var_59"),
                (else_try),
                    (party_slot_eq, ":var_58", slot_party_type, 2),
                    (val_add, ":var_56", ":var_59"),
                (else_try),
                    (val_add, ":var_55", ":var_59"),
                (try_end),
            (try_end),
        (try_end),
        (try_begin),
            (gt, ":var_54", 0),
            (store_random_in_range, ":var_60", 0, ":var_54"),
            (try_for_range, ":var_58", "p_town_1", "p_castle_1"),
                (party_slot_eq, ":var_58", slot_town_lord, "trp_player"),
                (val_sub, ":var_60", 1),
                (neg|ge, ":var_60", 0),
                (str_store_party_name, s9, ":var_58"),
            (try_end),
        (else_try),
            (gt, ":var_57", 0),
            (store_random_in_range, ":var_61", 0, ":var_57"),
            (try_for_range, ":var_58", "p_town_1", "p_castle_1"),
                (party_get_slot, ":var_59", ":var_58", slot_center_player_relation),
                (gt, ":var_59", 0),
                (val_sub, ":var_61", ":var_59"),
                (neg|ge, ":var_61", 0),
                (str_store_party_name, s9, ":var_58"),
            (try_end),
        (else_try),
            (store_random_in_range, ":var_60", "p_town_1", "p_castle_1"),
            (str_store_party_name, s9, ":var_60"),
        (try_end),
        (try_begin),
            (gt, ":var_53", 0),
            (store_random_in_range, ":var_62", 0, ":var_53"),
            (try_for_range, ":var_58", "p_castle_1", "p_village_1"),
                (party_slot_eq, ":var_58", slot_town_lord, "trp_player"),
                (val_sub, ":var_62", 1),
                (neg|ge, ":var_62", 0),
                (str_store_party_name, s8, ":var_58"),
            (try_end),
        (else_try),
            (gt, ":var_56", 0),
            (store_random_in_range, ":var_63", 0, ":var_56"),
            (try_for_range, ":var_58", "p_castle_1", "p_village_1"),
                (party_get_slot, ":var_59", ":var_58", slot_center_player_relation),
                (gt, ":var_59", 0),
                (val_sub, ":var_63", ":var_59"),
                (neg|ge, ":var_63", 0),
                (str_store_party_name, s8, ":var_58"),
            (try_end),
        (else_try),
            (store_random_in_range, ":var_62", "p_castle_1", "p_village_1"),
            (str_store_party_name, s8, ":var_62"),
        (try_end),
        (try_begin),
            (gt, ":var_52", 0),
            (store_random_in_range, ":var_64", 0, ":var_52"),
            (try_for_range, ":var_58", "p_village_1", "p_salt_mine"),
                (party_slot_eq, ":var_58", slot_town_lord, "trp_player"),
                (val_sub, ":var_64", 1),
                (neg|ge, ":var_64", 0),
                (str_store_party_name, s7, ":var_58"),
            (try_end),
        (else_try),
            (gt, ":var_55", 0),
            (store_random_in_range, ":var_65", 0, ":var_55"),
            (try_for_range, ":var_58", "p_village_1", "p_salt_mine"),
                (party_get_slot, ":var_59", ":var_58", slot_center_player_relation),
                (gt, ":var_59", 0),
                (val_sub, ":var_65", ":var_59"),
                (neg|ge, ":var_65", 0),
                (str_store_party_name, s7, ":var_58"),
            (try_end),
        (else_try),
            (store_random_in_range, ":var_64", "p_village_1", "p_salt_mine"),
            (str_store_party_name, s7, ":var_64"),
        (try_end),
        (assign, ":var_66", 0),
        (str_clear, s15),
        (try_for_range_backwards, ":var_67", "fac_player_supporters_faction", "fac_kingdoms_end"),
            (faction_slot_eq, ":var_67", slot_faction_state, 1),
            (neg|eq, ":var_67", "$players_kingdom"),
            (try_begin),
                (eq, ":var_66", 0),
                (str_store_faction_name, s15, ":var_67"),
                (str_store_string, s15, "@the {s15}"),
            (else_try),
                (eq, ":var_66", 1),
                (str_store_faction_name, s16, ":var_67"),
                (str_store_string, s15, "@the {s16} and {s15}"),
            (else_try),
                (str_store_faction_name, s16, ":var_67"),
                (str_store_string, s15, "@the {s16}, {s15}"),
            (try_end),
            (val_add, ":var_66", 1),
        (try_end),
        (try_begin),
            (gt, ":var_66", 0),
            (str_store_string, s15, "@ conquered {s15},"),
        (try_end),
        (call_script, "script_gender_to_reg63"),
        (try_begin),
            (eq, "$pop_kingdom", 1),
            (str_store_string, s13, "@self-proclaimed {reg63?king:queen}"),
        (else_try),
            (gt, "$players_kingdom", 0),
            (str_store_string, s13, "@minor lord"),
        (else_try),
            (str_store_string, s13, "@mercenary captain"),
        (try_end),
        (try_begin),
            (assign, ":var_68", 0),
            (try_begin),
                (eq, ":var_66", 5),
                (assign, ":var_68", 1),
            (else_try),
                (eq, ":var_66", 4),
                (is_between, "$players_kingdom", "fac_kingdom_1", "fac_kingdoms_end"),
                (faction_slot_eq, "$players_kingdom", slot_faction_state, 0),
                (assign, ":var_68", 1),
            (try_end),
            (eq, ":var_68", 1),
            (create_mesh_overlay_with_tableau_material, reg1, -1, "tableau_retirement_troop", 9),
            (str_store_string, s0, "str_retirement_text_10"),
        (else_try),
            (neg|ge, ":var_0", 250),
            (create_mesh_overlay_with_tableau_material, reg1, -1, "tableau_retirement_troop", 0),
            (str_store_string, s0, "str_retirement_text_1"),
        (else_try),
            (neg|ge, ":var_0", 500),
            (create_mesh_overlay_with_tableau_material, reg1, -1, "tableau_retirement_troop", 1),
            (str_store_string, s0, "str_retirement_text_2"),
        (else_try),
            (neg|ge, ":var_0", 1000),
            (create_mesh_overlay_with_tableau_material, reg1, -1, "tableau_retirement_troop", 2),
            (str_store_string, s0, "str_retirement_text_3"),
        (else_try),
            (neg|ge, ":var_0", 2000),
            (create_mesh_overlay_with_tableau_material, reg1, -1, "tableau_retirement_troop", 3),
            (str_store_string, s0, "str_retirement_text_4"),
        (else_try),
            (neg|ge, ":var_0", 4000),
            (create_mesh_overlay_with_tableau_material, reg1, -1, "tableau_retirement_troop", 4),
            (str_store_string, s0, "str_retirement_text_5"),
        (else_try),
            (neg|ge, ":var_0", 6500),
            (create_mesh_overlay_with_tableau_material, reg1, -1, "tableau_retirement_troop", 5),
            (str_store_string, s0, "str_retirement_text_6"),
        (else_try),
            (neg|ge, ":var_0", 9000),
            (create_mesh_overlay_with_tableau_material, reg1, -1, "tableau_retirement_troop", 6),
            (str_store_string, s0, "str_retirement_text_7"),
        (else_try),
            (neg|ge, ":var_0", 12000),
            (create_mesh_overlay_with_tableau_material, reg1, -1, "tableau_retirement_troop", 7),
            (str_store_string, s0, "str_retirement_text_8"),
        (else_try),
            (create_mesh_overlay_with_tableau_material, reg1, -1, "tableau_retirement_troop", 8),
            (str_store_string, s0, "str_retirement_text_9"),
        (try_end),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, 120),
        (overlay_set_position, reg1, pos1),
        (create_text_overlay, reg1, 0, 10240),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 120),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 360),
        (position_set_y, pos1, 190),
        (overlay_set_area_size, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
    ]),
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":var_0"),
        (try_begin),
            (eq, ":var_0", "$g_presentation_obj_retirement_1"),
            (jump_to_menu, "mnu_end_game"),
            (start_presentation, "prsnt_game_credits"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_retirement_2"),
            (presentation_set_duration, 0),
            (change_screen_return),
        (try_end),
    ]),
]),

("budget_report", 0, mesh_load_window, [
    (ti_on_presentation_load, [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        (create_mesh_overlay, reg1, "mesh_pic_payment"),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 170),
        (position_set_y, pos1, 0),
        (overlay_set_position, reg1, pos1),
        (create_text_overlay, reg1, "str_weekly_budget", 16),
        (position_set_x, pos1, 1500),
        (position_set_y, pos1, 1500),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 260),
        (position_set_y, pos1, 650),
        (overlay_set_position, reg1, pos1),
        (str_clear, s0),
        (create_text_overlay, "$g_presentation_obj_bugdet_report_container", 0, 131072),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, 100),
        (overlay_set_position, "$g_presentation_obj_bugdet_report_container", pos1),
        (position_set_x, pos1, 505),
        (position_set_y, pos1, 500),
        (overlay_set_area_size, "$g_presentation_obj_bugdet_report_container", pos1),
        (set_container_overlay, "$g_presentation_obj_bugdet_report_container"),
        (game_get_reduce_campaign_ai, ":var_0"),
        (try_begin),
            (eq, ":var_0", 0),
            (assign, ":var_1", 8),
            (assign, ":var_2", 4),
        (else_try),
            (eq, ":var_0", 1),
            (assign, ":var_1", 10),
            (assign, ":var_2", 3),
        (else_try),
            (eq, ":var_0", 2),
            (assign, ":var_1", 12),
            (assign, ":var_2", 2),
        (try_end),
        (assign, ":var_3", 0),
        (assign, ":var_4", 0),
        (assign, ":var_5", 0),
        (assign, ":var_6", 0),
        (try_for_range, ":var_7", "p_town_1", "p_salt_mine"),
            (try_begin),
                (party_slot_ge, ":var_7", slot_center_player_enterprise, 1),
                (val_add, ":var_3", 1),
            (try_end),
            (party_slot_eq, ":var_7", slot_town_lord, "trp_player"),
            (val_add, ":var_3", 1),
            (val_add, ":var_4", 1),
            (try_begin),
                (is_between, ":var_7", "p_town_1", "p_castle_1"),
                (val_add, ":var_3", 1),
                (val_add, ":var_4", 1),
            (try_end),
        (try_end),
        (try_begin),
            (gt, "$players_kingdom", 0),
            (neg|eq, "$players_kingdom", "fac_player_supporters_faction"),
            (neg|eq, "$players_kingdom", "fac_player_faction"),
            (eq, "$player_has_homage", 0),
            (val_add, ":var_3", 1),
        (try_end),
        (try_begin),
            (gt, ":var_4", ":var_1"),
            (val_add, ":var_3", 1),
        (try_end),
        (try_for_parties, ":var_8"),
            (assign, ":var_9", 0),
            (try_begin),
                (this_or_next|party_slot_eq, ":var_8", slot_party_type, 3),
                (party_slot_eq, ":var_8", slot_party_type, 2),
                (party_slot_eq, ":var_8", slot_town_lord, "trp_player"),
                (assign, ":var_9", 1),
            (else_try),
                (this_or_next|party_slot_eq, ":var_8", slot_party_type, 3),
                (party_slot_eq, ":var_8", slot_party_type, 2),
                (neg|party_slot_ge, ":var_8", slot_town_lord, 1),
                (store_faction_of_party, ":var_10", ":var_8"),
                (eq, ":var_10", "fac_player_supporters_faction"),
                (faction_slot_eq, "fac_player_supporters_faction", slot_faction_leader, "trp_player"),
                (assign, ":var_9", 1),
            (try_end),
            (this_or_next|eq, ":var_8", "p_main_party"),
            (eq, ":var_9", 1),
            (val_add, ":var_3", 1),
        (try_end),
        (try_begin),
            (gt, "$g_player_debt_to_party_members", 0),
            (val_add, ":var_3", 2),
        (try_end),
        (val_add, ":var_3", 3),
        (store_mul, ":var_11", 27, ":var_3"),
        (assign, ":var_12", 0),
        (try_for_range, ":var_7", "p_town_1", "p_salt_mine"),
            (try_begin),
                (party_get_slot, ":var_13", ":var_7", slot_center_player_enterprise),
                (gt, ":var_13", 1),
                (neg|party_slot_ge, ":var_7", slot_center_player_enterprise_consumption_order, 1),
                (str_store_party_name, s0, ":var_7"),
                (call_script, "script_process_player_enterprise", ":var_13", ":var_7"),
                (assign, ":var_14", reg0),
                (assign, ":var_15", reg4),
                (assign, ":var_16", reg5),
                (assign, ":var_17", reg10),
                (store_sub, ":var_18", ":var_7", "p_town_1"),
                (store_add, ":var_19", ":var_18", "trp_town_1_master_craftsman"),
                (item_get_slot, ":var_20", ":var_13", slot_item_output_per_run),
                (assign, ":var_21", 0),
                (try_begin),
                    (party_slot_eq, ":var_7", slot_center_player_enterprise_production_order, 1),
                    (assign, ":var_22", 0),
                    (troop_get_inventory_capacity, ":var_23", ":var_19"),
                    (try_for_range, ":var_24", 0, ":var_23"),
                        (troop_get_inventory_slot, ":var_25", ":var_19", ":var_24"),
                        (neg|ge, ":var_25", 1),
                        (val_add, ":var_22", 1),
                    (try_end),
                    (assign, ":var_21", ":var_20"),
                    (val_min, ":var_21", ":var_22"),
                    (gt, ":var_21", 0),
                    (store_mul, ":var_26", ":var_15", ":var_21"),
                    (val_sub, ":var_14", ":var_26"),
                    (val_sub, ":var_20", ":var_21"),
                (try_end),
                (try_begin),
                    (eq, "$g_apply_budget_report_to_gold", 1),
                    (troop_add_items, ":var_19", ":var_13", ":var_21"),
                    (store_sub, ":var_27", ":var_13", "itm_spice"),
                    (val_add, ":var_27", 301),
                    (party_get_slot, ":var_28", ":var_7", ":var_27"),
                    (store_mul, ":var_29", ":var_20", 15),
                    (val_sub, ":var_28", ":var_29"),
                    (party_set_slot, ":var_7", ":var_27", ":var_28"),
                    (gt, "$cheat_mode", 0),
                    (str_store_troop_name, s3, ":var_19"),
                    (assign, reg3, ":var_21"),
                    (display_message, "@{!}DEBUG -- Adding {reg3} items to {s3}"),
                (try_end),
                (item_get_slot, ":var_30", ":var_13", slot_item_input_number),
                (try_begin),
                    (item_slot_ge, ":var_13", slot_item_secondary_raw_material, 1),
                    (assign, ":var_31", ":var_30"),
                (else_try),
                    (assign, ":var_31", 0),
                (try_end),
                (assign, ":var_32", 0),
                (assign, ":var_33", 0),
                (try_begin),
                    (troop_get_inventory_capacity, ":var_23", ":var_19"),
                    (try_for_range, ":var_24", 0, ":var_23"),
                        (troop_get_inventory_slot, ":var_34", ":var_19", ":var_24"),
                        (neg|ge, ":var_32", ":var_30"),
                        (item_slot_eq, ":var_13", slot_item_primary_raw_material, ":var_34"),
                        (val_add, ":var_32", 1),
                    (else_try),
                        (neg|ge, ":var_33", ":var_31"),
                        (item_slot_eq, ":var_13", slot_item_secondary_raw_material, ":var_34"),
                        (val_add, ":var_33", 1),
                    (try_end),
                    (try_begin),
                        (gt, ":var_32", 0),
                        (val_sub, ":var_30", ":var_32"),
                        (store_mul, ":var_35", ":var_16", ":var_32"),
                        (val_add, ":var_14", ":var_35"),
                    (try_end),
                    (try_begin),
                        (gt, ":var_33", 0),
                        (val_sub, ":var_31", ":var_33"),
                        (assign, ":var_35", ":var_17"),
                        (val_add, ":var_14", ":var_35"),
                    (try_end),
                (try_end),
                (try_begin),
                    (eq, "$g_apply_budget_report_to_gold", 1),
                    (item_get_slot, ":var_36", ":var_13", slot_item_primary_raw_material),
                    (troop_remove_items, ":var_19", ":var_36", ":var_32"),
                    (item_get_slot, ":var_37", ":var_13", slot_item_secondary_raw_material),
                    (troop_remove_items, ":var_19", ":var_37", ":var_33"),
                    (store_sub, ":var_27", ":var_36", "itm_spice"),
                    (val_add, ":var_27", 301),
                    (party_get_slot, ":var_28", ":var_7", ":var_27"),
                    (store_mul, ":var_29", ":var_20", 15),
                    (val_add, ":var_28", ":var_29"),
                    (party_set_slot, ":var_7", ":var_27", ":var_28"),
                    (try_begin),
                        (gt, ":var_31", 0),
                        (store_sub, ":var_27", ":var_37", "itm_spice"),
                        (val_add, ":var_27", 301),
                        (party_get_slot, ":var_28", ":var_7", ":var_27"),
                        (val_add, ":var_28", 15),
                        (party_set_slot, ":var_7", ":var_27", ":var_28"),
                    (try_end),
                (try_end),
                (call_script, "script_get_enterprise_name", ":var_13"),
                (str_store_string, s5, reg0),
                (create_text_overlay, reg1, "str_enterprise_s5_at_s0", 0),
                (position_set_x, pos1, 900),
                (position_set_y, pos1, 900),
                (overlay_set_size, reg1, pos1),
                (position_set_x, pos1, 25),
                (position_set_y, pos1, ":var_11"),
                (overlay_set_position, reg1, pos1),
                (assign, reg0, ":var_14"),
                (try_begin),
                    (store_faction_of_party, ":var_38", ":var_7"),
                    (store_relation, ":var_39", ":var_38", "$players_kingdom"),
                    (neg|ge, ":var_39", 0),
                    (assign, reg0, 0),
                    (assign, ":var_14", 0),
                    (create_text_overlay, reg1, "str_under_sequestration", 32776),
                    (overlay_set_color, reg1, 16711680),
                (else_try),
                    (ge, reg0, 0),
                    (create_text_overlay, reg1, "@{!}{reg0}", 32776),
                    (overlay_set_color, reg1, 43520),
                (else_try),
                    (create_text_overlay, reg1, "@{!}{reg0}", 32776),
                    (overlay_set_color, reg1, 16711680),
                (try_end),
                (val_add, ":var_5", ":var_14"),
                (val_add, ":var_12", ":var_14"),
                (position_set_x, pos1, 900),
                (position_set_y, pos1, 900),
                (overlay_set_size, reg1, pos1),
                (position_set_x, pos1, 500),
                (position_set_y, pos1, ":var_11"),
                (overlay_set_position, reg1, pos1),
                (val_sub, ":var_11", 27),
            (try_end),
            (party_slot_eq, ":var_7", slot_town_lord, "trp_player"),
            (party_get_slot, ":var_40", ":var_7", slot_center_accumulated_rents),
            (party_get_slot, ":var_41", ":var_7", slot_center_accumulated_tariffs),
            (store_add, ":var_42", ":var_40", ":var_41"),
            (val_add, ":var_5", ":var_42"),
            (val_add, ":var_6", ":var_42"),
            (val_add, ":var_12", ":var_42"),
            (str_store_party_name, s0, ":var_7"),
            (create_text_overlay, reg1, "str_rents_from_s0", 0),
            (position_set_x, pos1, 900),
            (position_set_y, pos1, 900),
            (overlay_set_size, reg1, pos1),
            (position_set_x, pos1, 25),
            (position_set_y, pos1, ":var_11"),
            (overlay_set_position, reg1, pos1),
            (try_begin),
                (gt, ":var_40", 0),
                (assign, reg0, ":var_40"),
                (create_text_overlay, reg1, "@{!}{reg0}", 32776),
                (overlay_set_color, reg1, 43520),
            (else_try),
                (create_text_overlay, reg1, "@None", 32776),
            (try_end),
            (position_set_x, pos1, 900),
            (position_set_y, pos1, 900),
            (overlay_set_size, reg1, pos1),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, ":var_11"),
            (overlay_set_position, reg1, pos1),
            (val_sub, ":var_11", 27),
            (try_begin),
                (is_between, ":var_7", "p_town_1", "p_castle_1"),
                (create_text_overlay, reg1, "str_tariffs_from_s0", 0),
                (position_set_x, pos1, 900),
                (position_set_y, pos1, 900),
                (overlay_set_size, reg1, pos1),
                (position_set_x, pos1, 25),
                (position_set_y, pos1, ":var_11"),
                (overlay_set_position, reg1, pos1),
                (try_begin),
                    (gt, ":var_41", 0),
                    (assign, reg0, ":var_41"),
                    (create_text_overlay, reg1, "@{!}{reg0}", 32776),
                    (overlay_set_color, reg1, 43520),
                (else_try),
                    (create_text_overlay, reg1, "@None", 32776),
                (try_end),
                (position_set_x, pos1, 900),
                (position_set_y, pos1, 900),
                (overlay_set_size, reg1, pos1),
                (position_set_x, pos1, 500),
                (position_set_y, pos1, ":var_11"),
                (overlay_set_position, reg1, pos1),
                (val_sub, ":var_11", 27),
            (try_end),
        (try_end),
        (try_begin),
            (gt, "$players_kingdom", 0),
            (neg|eq, "$players_kingdom", "fac_player_supporters_faction"),
            (neg|eq, "$players_kingdom", "fac_player_faction"),
            (eq, "$player_has_homage", 0),
            (str_store_faction_name, s0, "$players_kingdom"),
            (create_text_overlay, reg1, "str_mercenary_payment_from_s0", 0),
            (position_set_x, pos1, 900),
            (position_set_y, pos1, 900),
            (overlay_set_size, reg1, pos1),
            (position_set_x, pos1, 25),
            (position_set_y, pos1, ":var_11"),
            (overlay_set_position, reg1, pos1),
            (call_script, "script_party_calculate_strength", "p_main_party", 0),
            (assign, ":var_43", reg0),
            (val_div, ":var_43", 2),
            (val_add, ":var_43", 30),
            (call_script, "script_round_value", ":var_43"),
            (val_add, ":var_12", reg0),
            (create_text_overlay, reg1, "@{!}{reg0}", 32776),
            (position_set_x, pos1, 900),
            (position_set_y, pos1, 900),
            (overlay_set_size, reg1, pos1),
            (overlay_set_color, reg1, 43520),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, ":var_11"),
            (overlay_set_position, reg1, pos1),
            (val_sub, ":var_11", 27),
        (try_end),
        (try_begin),
            (gt, ":var_4", ":var_1"),
            (gt, ":var_5", 0),
            (store_sub, ":var_44", ":var_4", ":var_1"),
            (val_mul, ":var_44", ":var_2"),
            (val_min, ":var_44", 65),
            (store_mul, ":var_45", ":var_6", ":var_44"),
            (val_div, ":var_45", 100),
            (val_sub, ":var_12", ":var_45"),
            (create_text_overlay, reg1, "str_loss_due_to_tax_inefficiency", 0),
            (position_set_x, pos1, 25),
            (position_set_y, pos1, ":var_11"),
            (overlay_set_position, reg1, pos1),
            (position_set_x, pos1, 900),
            (position_set_y, pos1, 900),
            (overlay_set_size, reg1, pos1),
            (store_mul, reg0, ":var_45", -1),
            (create_text_overlay, reg1, "@{!}{reg0}", 32776),
            (position_set_x, pos1, 900),
            (position_set_y, pos1, 900),
            (overlay_set_size, reg1, pos1),
            (overlay_set_color, reg1, 16711680),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, ":var_11"),
            (overlay_set_position, reg1, pos1),
            (val_sub, ":var_11", 27),
        (try_end),
        (try_for_parties, ":var_8"),
            (assign, ":var_9", 0),
            (assign, ":var_46", 0),
            (try_begin),
                (this_or_next|party_slot_eq, ":var_8", slot_party_type, 3),
                (party_slot_eq, ":var_8", slot_party_type, 2),
                (party_slot_eq, ":var_8", slot_town_lord, "trp_player"),
                (assign, ":var_9", 1),
            (else_try),
                (this_or_next|party_slot_eq, ":var_8", slot_party_type, 3),
                (party_slot_eq, ":var_8", slot_party_type, 2),
                (neg|party_slot_ge, ":var_8", slot_town_lord, 1),
                (store_faction_of_party, ":var_10", ":var_8"),
                (eq, ":var_10", "fac_player_supporters_faction"),
                (faction_slot_eq, "fac_player_supporters_faction", slot_faction_leader, "trp_player"),
                (assign, ":var_9", 1),
            (else_try),
                (troop_get_slot, ":var_47", "trp_player", slot_troop_will_join_prison_break),
                (gt, ":var_47", 0),
                (eq, ":var_8", ":var_47"),
                (party_is_active, ":var_47"),
                (assign, ":var_46", 1),
            (try_end),
            (this_or_next|eq, ":var_8", "p_main_party"),
            (this_or_next|eq, ":var_46", 1),
            (eq, ":var_9", 1),
            (assign, ":var_48", 0),
            (party_get_num_companion_stacks, ":var_49", ":var_8"),
            (try_for_range, ":var_50", 0, ":var_49"),
                (party_stack_get_troop_id, ":var_51", ":var_8", ":var_50"),
                (party_stack_get_size, ":var_52", ":var_8", ":var_50"),
                (call_script, "script_game_get_troop_wage", ":var_51", ":var_8"),
                (assign, ":var_53", reg0),
                (val_mul, ":var_53", ":var_52"),
                (val_add, ":var_48", ":var_53"),
            (try_end),
            (try_begin),
                (eq, ":var_9", 1),
                (val_div, ":var_48", 2),
            (else_try),
                (eq, ":var_8", "p_main_party"),
                (store_sub, ":var_54", 14, "$g_cur_week_half_daily_wage_payments"),
                (val_mul, ":var_48", ":var_54"),
                (val_div, ":var_48", 14),
            (else_try),
                (eq, ":var_46", 1),
                (val_mul, ":var_48", 120),
                (val_div, ":var_48", 100),
            (try_end),
            (val_mul, ":var_48", -1),
            (val_add, ":var_12", ":var_48"),
            (str_store_party_name, s0, ":var_8"),
            (try_begin),
                (eq, ":var_8", "p_main_party"),
                (str_store_string, s0, "str_s0s_party"),
            (try_end),
            (create_text_overlay, reg1, "str_wages_for_s0", 0),
            (position_set_x, pos1, 900),
            (position_set_y, pos1, 900),
            (overlay_set_size, reg1, pos1),
            (position_set_x, pos1, 25),
            (position_set_y, pos1, ":var_11"),
            (overlay_set_position, reg1, pos1),
            (try_begin),
                (neg|ge, ":var_48", 0),
                (assign, reg0, ":var_48"),
                (create_text_overlay, reg1, "@{!}{reg0}", 32776),
                (overlay_set_color, reg1, 16711680),
            (else_try),
                (create_text_overlay, reg1, "@None", 32776),
            (try_end),
            (position_set_x, pos1, 900),
            (position_set_y, pos1, 900),
            (overlay_set_size, reg1, pos1),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, ":var_11"),
            (overlay_set_position, reg1, pos1),
            (val_sub, ":var_11", 27),
        (try_end),
        (try_begin),
            (gt, "$g_player_debt_to_party_members", 0),
            (val_sub, ":var_12", "$g_player_debt_to_party_members"),
            (create_text_overlay, reg1, "str_earlier_debts", 0),
            (position_set_x, pos1, 900),
            (position_set_y, pos1, 900),
            (overlay_set_size, reg1, pos1),
            (position_set_x, pos1, 25),
            (position_set_y, pos1, ":var_11"),
            (overlay_set_position, reg1, pos1),
            (store_mul, reg0, "$g_player_debt_to_party_members", -1),
            (create_text_overlay, reg1, "@{!}{reg0}", 32776),
            (position_set_x, pos1, 900),
            (position_set_y, pos1, 900),
            (overlay_set_size, reg1, pos1),
            (overlay_set_color, reg1, 16711680),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, ":var_11"),
            (overlay_set_position, reg1, pos1),
            (val_sub, ":var_11", 27),
        (try_end),
        (create_mesh_overlay, reg1, "mesh_white_plane"),
        (overlay_set_color, reg1, 0),
        (position_set_x, pos1, 24000),
        (position_set_y, pos1, 50),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 25),
        (store_add, ":var_55", ":var_11", 25),
        (position_set_y, pos1, ":var_55"),
        (overlay_set_position, reg1, pos1),
        (create_text_overlay, reg1, "str_net_change", 0),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 25),
        (position_set_y, pos1, ":var_11"),
        (overlay_set_position, reg1, pos1),
        (assign, reg0, ":var_12"),
        (create_text_overlay, reg1, "@{!}{reg0}", 32776),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg1, pos1),
        (try_begin),
            (gt, reg0, 0),
            (overlay_set_color, reg1, 43520),
        (else_try),
            (neg|ge, reg0, 0),
            (overlay_set_color, reg1, 16711680),
        (try_end),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, ":var_11"),
        (overlay_set_position, reg1, pos1),
        (val_sub, ":var_11", 27),
        (create_text_overlay, reg1, "str_earlier_wealth", 0),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 25),
        (position_set_y, pos1, ":var_11"),
        (overlay_set_position, reg1, pos1),
        (store_troop_gold, ":var_56", "trp_player"),
        (assign, reg0, ":var_56"),
        (create_text_overlay, reg1, "@{!}{reg0}", 32776),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, ":var_11"),
        (overlay_set_position, reg1, pos1),
        (val_sub, ":var_11", 27),
        (val_mul, ":var_12", -1),
        (try_begin),
            (ge, ":var_56", ":var_12"),
            (assign, ":var_57", ":var_12"),
            (assign, ":var_58", 0),
        (else_try),
            (assign, ":var_57", ":var_56"),
            (store_sub, ":var_58", ":var_12", ":var_56"),
        (try_end),
        (create_text_overlay, reg1, "str_new_wealth", 0),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 25),
        (position_set_y, pos1, ":var_11"),
        (overlay_set_position, reg1, pos1),
        (store_sub, reg0, ":var_56", ":var_57"),
        (create_text_overlay, reg1, "@{!}{reg0}", 32776),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, ":var_11"),
        (overlay_set_position, reg1, pos1),
        (val_sub, ":var_11", 27),
        (try_begin),
            (gt, ":var_58", 0),
            (create_text_overlay, reg1, "str_new_debts", 0),
            (position_set_x, pos1, 900),
            (position_set_y, pos1, 900),
            (overlay_set_size, reg1, pos1),
            (position_set_x, pos1, 25),
            (position_set_y, pos1, ":var_11"),
            (overlay_set_position, reg1, pos1),
            (assign, reg0, ":var_58"),
            (create_text_overlay, reg1, "@{!}{reg0}", 32776),
            (position_set_x, pos1, 900),
            (position_set_y, pos1, 900),
            (overlay_set_size, reg1, pos1),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, ":var_11"),
            (overlay_set_position, reg1, pos1),
            (val_sub, ":var_11", 27),
            (neg|eq, "$g_apply_budget_report_to_gold", 0),
            (call_script, "script_objectionable_action", 2, "str_men_unpaid"),
        (try_end),
        (set_container_overlay, -1),
        (create_button_overlay, "$g_presentation_obj_budget_report_1", "@Continue..."),
        (position_set_x, pos1, 225),
        (position_set_y, pos1, 60),
        (overlay_set_position, "$g_presentation_obj_budget_report_1", pos1),
        (try_begin),
            (eq, "$g_apply_budget_report_to_gold", 1),
            (assign, "$g_player_debt_to_party_members", ":var_58"),
            (try_begin),
                (gt, ":var_57", 0),
                (troop_remove_gold, "trp_player", ":var_57"),
            (else_try),
                (val_mul, ":var_57", -1),
                (troop_add_gold, "trp_player", ":var_57"),
            (try_end),
            (try_for_range, ":var_7", "p_town_1", "p_salt_mine"),
                (party_slot_eq, ":var_7", slot_town_lord, "trp_player"),
                (party_set_slot, ":var_7", slot_center_accumulated_rents, 0),
                (party_set_slot, ":var_7", slot_center_accumulated_tariffs, 0),
            (try_end),
            (assign, "$g_cur_week_half_daily_wage_payments", 0),
        (try_end),
    ]),
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":var_0"),
        (try_begin),
            (eq, ":var_0", "$g_presentation_obj_budget_report_1"),
            (presentation_set_duration, 0),
        (try_end),
    ]),
]),

("game_before_quit", 0, mesh_load_window, [
    (ti_on_presentation_load, [
        (try_begin),
            (is_trial_version),
            (set_fixed_point_multiplier, 1000),
            (create_mesh_overlay, reg0, "mesh_quit_adv"),
            (position_set_x, pos1, -1),
            (position_set_y, pos1, -1),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 1002),
            (position_set_y, pos1, 1002),
            (overlay_set_size, reg0, pos1),
            (assign, "$g_game_before_quit_state", 0),
            (presentation_set_duration, 999999),
        (try_end),
    ]),
    (ti_on_presentation_run, [
        (store_trigger_param_1, ":var_0"),
        (gt, ":var_0", 500),
        (try_begin),
            (this_or_next|key_clicked, key_space),
            (this_or_next|key_clicked, key_enter),
            (this_or_next|key_clicked, key_escape),
            (this_or_next|key_clicked, key_back_space),
            (this_or_next|key_clicked, key_left_mouse_button),
            (key_clicked, key_right_mouse_button),
            (try_begin),
                (eq, "$g_game_before_quit_state", 0),
                (val_add, "$g_game_before_quit_state", 1),
                (create_mesh_overlay, reg0, "mesh_quit_adv_b"),
                (position_set_x, pos1, -1),
                (position_set_y, pos1, -1),
                (overlay_set_position, reg0, pos1),
                (position_set_x, pos1, 1002),
                (position_set_y, pos1, 1002),
                (overlay_set_size, reg0, pos1),
            (else_try),
                (presentation_set_duration, 0),
            (try_end),
        (try_end),
    ]),
]),

("multiplayer_duel_start_counter", prsntf_manual_end_only|prsntf_read_only, 0, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (assign, "$g_multiplayer_duel_start_counter_overlay", -1),
        (assign, "$g_multiplayer_last_duel_start_counter_value", -1),
        (str_clear, s0),
        (create_text_overlay, "$g_multiplayer_duel_start_counter_overlay", 0, 65552),
        (overlay_set_color, "$g_multiplayer_duel_start_counter_overlay", 16777215),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 600),
        (overlay_set_position, "$g_multiplayer_duel_start_counter_overlay", pos1),
        (position_set_x, pos1, 2000),
        (position_set_y, pos1, 2000),
        (overlay_set_size, "$g_multiplayer_duel_start_counter_overlay", pos1),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_run, [
        (ge, "$g_multiplayer_duel_start_counter_overlay", 0),
        (store_mission_timer_a, ":var_0"),
        (store_sub, ":var_1", ":var_0", "$g_multiplayer_duel_start_time"),
        (store_sub, ":var_2", 3, ":var_1"),
        (try_begin),
            (neg|gt, ":var_2", 0),
            (presentation_set_duration, 0),
        (else_try),
            (neg|eq, "$g_multiplayer_last_duel_start_counter_value", ":var_2"),
            (assign, "$g_multiplayer_last_duel_start_counter_value", ":var_2"),
            (assign, reg0, ":var_2"),
            (str_store_string, s0, "str_duel_starts_in_reg0_seconds"),
            (overlay_set_text, "$g_multiplayer_duel_start_counter_overlay", 0),
        (try_end),
    ]),
]),

("achievement_report", 0, mesh_load_window, [
    (ti_on_presentation_load, [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        (assign, ":var_0", 1000),
        (assign, ":var_1", 45),
        (assign, ":var_2", 0),
        (assign, ":var_3", 300),
        (store_mul, ":var_4", ":var_3", 600),
        (val_div, ":var_4", 1000),
        (assign, ":var_5", ":var_1"),
        (store_add, ":var_6", ":var_4", ":var_1"),
        (store_sub, ":var_6", ":var_0", ":var_6"),
        (store_add, ":var_7", ":var_1", ":var_4"),
        (val_add, ":var_7", ":var_2"),
        (store_sub, ":var_8", ":var_6", ":var_2"),
        (assign, ":var_9", 505),
        (assign, ":var_10", 600),
        (store_sub, ":var_11", ":var_10", 15),
        (assign, ":var_12", 100),
        (assign, ":var_13", 5),
        (store_current_day, ":var_14"),
        (assign, reg5, ":var_14"),
        (str_store_troop_name, s4, "trp_player"),
        (create_text_overlay, reg1, "@{s4}'s achievements after {reg5} days of adventuring.", 16),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 695),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 1300),
        (position_set_y, pos1, 1300),
        (overlay_set_size, reg1, pos1),
        (call_script, "script_gender_to_reg63"),
        (try_begin),
            (assign, ":var_15", 0),
            (assign, ":var_16", 0),
            (assign, ":var_17", -1),
            (store_mul, ":var_18", "$g_achievement_page_no", ":var_13"),
            (try_for_range, ":var_19", 0, 28),
                (assign, ":var_20", -1),
                (try_begin),
                    (store_and, ":var_16", "$g_achieve_bitfield", 1),
                    (neg|eq, ":var_16", 0),
                    (store_and, ":var_16", ":var_15", 1),
                    (eq, ":var_16", 0),
                    (val_or, ":var_15", 1),
                    (assign, ":var_20", 0),
                    (str_store_string, s0, "@Deathbringer"),
                    (assign, reg0, 50),
                    (str_store_string, s1, "@(killed {reg0} enemies in a single battle)"),
                (else_try),
                    (store_and, ":var_16", "$g_achieve_bitfield", 2),
                    (neg|eq, ":var_16", 0),
                    (store_and, ":var_16", ":var_15", 2),
                    (eq, ":var_16", 0),
                    (val_or, ":var_15", 2),
                    (assign, ":var_20", 1),
                    (str_store_string, s0, "@Masterful Warrior"),
                    (assign, reg0, 5000),
                    (str_store_string, s1, "@({reg0} enemies killed or wounded)"),
                (else_try),
                    (store_and, ":var_16", "$g_achieve_bitfield", 4),
                    (neg|eq, ":var_16", 0),
                    (store_and, ":var_16", ":var_15", 4),
                    (eq, ":var_16", 0),
                    (val_or, ":var_15", 4),
                    (assign, ":var_20", 2),
                    (str_store_string, s0, "@Legendary Warrior"),
                    (assign, reg0, 10000),
                    (str_store_string, s1, "@({reg0} enemies killed or wounded)"),
                (else_try),
                    (store_and, ":var_16", "$g_achieve_bitfield", 8),
                    (neg|eq, ":var_16", 0),
                    (store_and, ":var_16", ":var_15", 8),
                    (eq, ":var_16", 0),
                    (val_or, ":var_15", 8),
                    (assign, ":var_20", 3),
                    (str_store_string, s0, "@Battle Master"),
                    (assign, reg0, 250),
                    (str_store_string, s1, "@(won {reg0} victories)"),
                (else_try),
                    (store_and, ":var_16", "$g_achieve_bitfield", 16),
                    (neg|eq, ":var_16", 0),
                    (store_and, ":var_16", ":var_15", 16),
                    (eq, ":var_16", 0),
                    (val_or, ":var_15", 16),
                    (assign, ":var_20", 4),
                    (str_store_string, s0, "@Great General"),
                    (assign, reg0, 500),
                    (str_store_string, s1, "@(won {reg0} victories)"),
                (else_try),
                    (store_and, ":var_16", "$g_achieve_bitfield", 32),
                    (neg|eq, ":var_16", 0),
                    (store_and, ":var_16", ":var_15", 32),
                    (eq, ":var_16", 0),
                    (val_or, ":var_15", 32),
                    (assign, ":var_20", 5),
                    (str_store_string, s0, "@Defender of Pendor"),
                    (assign, reg0, 7),
                    (str_store_string, s1, "@(defeated {reg0} heroes)"),
                (else_try),
                    (store_and, ":var_16", "$g_achieve_bitfield", 64),
                    (neg|eq, ":var_16", 0),
                    (store_and, ":var_16", ":var_15", 64),
                    (eq, ":var_16", 0),
                    (val_or, ":var_15", 64),
                    (assign, ":var_20", 6),
                    (str_store_string, s0, "@Guardian of Pendor"),
                    (assign, reg0, 15),
                    (str_store_string, s1, "@(defeated {reg0} heroes)"),
                (else_try),
                    (store_and, ":var_16", "$g_achieve_bitfield", 128),
                    (neg|eq, ":var_16", 0),
                    (store_and, ":var_16", ":var_15", 128),
                    (eq, ":var_16", 0),
                    (val_or, ":var_15", 128),
                    (assign, ":var_20", 7),
                    (str_store_string, s0, "@Bane of Vejovis"),
                    (str_store_string, s1, "@(wiped out a Mystmountain army)"),
                (else_try),
                    (store_and, ":var_16", "$g_achieve_bitfield", 256),
                    (neg|eq, ":var_16", 0),
                    (store_and, ":var_16", ":var_15", 256),
                    (eq, ":var_16", 0),
                    (val_or, ":var_15", 256),
                    (assign, ":var_20", 8),
                    (str_store_string, s0, "@Cult Banisher"),
                    (str_store_string, s1, "@(wiped out a Snake Cult army)"),
                (else_try),
                    (store_and, ":var_16", "$g_achieve_bitfield", 512),
                    (neg|eq, ":var_16", 0),
                    (store_and, ":var_16", ":var_15", 512),
                    (eq, ":var_16", 0),
                    (val_or, ":var_15", 512),
                    (assign, ":var_20", 9),
                    (str_store_string, s0, "@Scourge of Jatu"),
                    (str_store_string, s1, "@(wiped out a Jatu army)"),
                (else_try),
                    (store_and, ":var_16", "$g_achieve_bitfield", 1024),
                    (neg|eq, ":var_16", 0),
                    (store_and, ":var_16", ":var_15", 1024),
                    (eq, ":var_16", 0),
                    (val_or, ":var_15", 1024),
                    (assign, ":var_20", 10),
                    (str_store_string, s0, "@Purger of Heresy"),
                    (str_store_string, s1, "@(wiped out a Heretic army)"),
                (else_try),
                    (store_and, ":var_16", "$g_achieve_bitfield", 2048),
                    (neg|eq, ":var_16", 0),
                    (store_and, ":var_16", ":var_15", 2048),
                    (eq, ":var_16", 0),
                    (val_or, ":var_15", 2048),
                    (assign, ":var_20", 11),
                    (str_store_string, s0, "@Arena Survivor"),
                    (assign, reg0, 25),
                    (str_store_string, s1, "@(won in {reg0} tournaments)"),
                (else_try),
                    (store_and, ":var_16", "$g_achieve_bitfield", 4096),
                    (neg|eq, ":var_16", 0),
                    (store_and, ":var_16", ":var_15", 4096),
                    (eq, ":var_16", 0),
                    (val_or, ":var_15", 4096),
                    (assign, ":var_20", 12),
                    (str_store_string, s0, "@Tournament Champion"),
                    (assign, reg0, 50),
                    (str_store_string, s1, "@(won in {reg0} tournaments)"),
                (else_try),
                    (store_and, ":var_16", "$g_achieve_bitfield", 8192),
                    (neg|eq, ":var_16", 0),
                    (store_and, ":var_16", ":var_15", 8192),
                    (eq, ":var_16", 0),
                    (val_or, ":var_15", 8192),
                    (assign, ":var_20", 13),
                    (str_store_string, s0, "@{reg63?Hero:Heroine} of Pendor"),
                    (assign, reg0, 5000),
                    (str_store_string, s1, "@(gained {reg0} renown)"),
                (else_try),
                    (store_and, ":var_16", "$g_achieve_bitfield", 16384),
                    (neg|eq, ":var_16", 0),
                    (store_and, ":var_16", ":var_15", 16384),
                    (eq, ":var_16", 0),
                    (val_or, ":var_15", 16384),
                    (assign, ":var_20", 14),
                    (str_store_string, s0, "@{reg63?Lion:Lioness} of Pendor"),
                    (assign, reg0, 7500),
                    (str_store_string, s1, "@(gained {reg0} renown)"),
                (else_try),
                    (store_and, ":var_16", "$g_achieve_bitfield", 32768),
                    (neg|eq, ":var_16", 0),
                    (store_and, ":var_16", ":var_15", 32768),
                    (eq, ":var_16", 0),
                    (val_or, ":var_15", 32768),
                    (assign, ":var_20", 15),
                    (str_store_string, s0, "@Chevalier of Pendor"),
                    (assign, reg0, 500),
                    (str_store_string, s1, "@(gained {reg0} honor)"),
                (else_try),
                    (store_and, ":var_16", "$g_achieve_bitfield", 65536),
                    (neg|eq, ":var_16", 0),
                    (store_and, ":var_16", ":var_15", 65536),
                    (eq, ":var_16", 0),
                    (val_or, ":var_15", 65536),
                    (assign, ":var_20", 16),
                    (str_store_string, s0, "@Rogue {reg63?King:Queen}"),
                    (str_store_string, s1, "@(declared a sovereign kingdom)"),
                (else_try),
                    (store_and, ":var_16", "$g_achieve_bitfield", 131072),
                    (neg|eq, ":var_16", 0),
                    (store_and, ":var_16", ":var_15", 131072),
                    (eq, ":var_16", 0),
                    (val_or, ":var_15", 131072),
                    (assign, ":var_20", 17),
                    (str_store_string, s0, "@Great Persuader"),
                    (assign, reg0, 30),
                    (str_store_string, s1, "@(persuaded {reg0} lords to join kingdom)"),
                (else_try),
                    (store_and, ":var_16", "$g_achieve_bitfield", 262144),
                    (neg|eq, ":var_16", 0),
                    (store_and, ":var_16", ":var_15", 262144),
                    (eq, ":var_16", 0),
                    (val_or, ":var_15", 262144),
                    (assign, ":var_20", 18),
                    (str_store_string, s0, "@Master Builder"),
                    (assign, reg0, 30),
                    (str_store_string, s1, "@(built {reg0} improvements)"),
                (else_try),
                    (store_and, ":var_16", "$g_achieve_bitfield", 524288),
                    (neg|eq, ":var_16", 0),
                    (store_and, ":var_16", ":var_15", 524288),
                    (eq, ":var_16", 0),
                    (val_or, ":var_15", 524288),
                    (assign, ":var_20", 19),
                    (str_store_string, s0, "@Competent Aide"),
                    (assign, reg0, 30),
                    (str_store_string, s1, "@(completed {reg0} quests)"),
                (else_try),
                    (store_and, ":var_16", "$g_achieve_bitfield", 1048576),
                    (neg|eq, ":var_16", 0),
                    (store_and, ":var_16", ":var_15", 1048576),
                    (eq, ":var_16", 0),
                    (val_or, ":var_15", 1048576),
                    (assign, ":var_20", 20),
                    (str_store_string, s0, "@Epitome of Ineptitude"),
                    (assign, reg0, 10),
                    (str_store_string, s1, "@(failed {reg0} quests)"),
                (else_try),
                    (store_and, ":var_16", "$g_achieve_bitfield", 2097152),
                    (neg|eq, ":var_16", 0),
                    (store_and, ":var_16", ":var_15", 2097152),
                    (eq, ":var_16", 0),
                    (val_or, ":var_15", 2097152),
                    (assign, ":var_20", 21),
                    (str_store_string, s0, "@Slippery Fellow"),
                    (assign, reg0, 10),
                    (str_store_string, s1, "@(captured {reg0} times)"),
                (else_try),
                    (store_and, ":var_16", "$g_achieve_bitfield", 4194304),
                    (neg|eq, ":var_16", 0),
                    (store_and, ":var_16", ":var_15", 4194304),
                    (eq, ":var_16", 0),
                    (val_or, ":var_15", 4194304),
                    (assign, ":var_20", 22),
                    (str_store_string, s0, "@Caravan Marauder"),
                    (assign, reg0, 30),
                    (str_store_string, s1, "@(raided {reg0} caravans)"),
                (else_try),
                    (store_and, ":var_16", "$g_achieve_bitfield", 8388608),
                    (neg|eq, ":var_16", 0),
                    (store_and, ":var_16", ":var_15", 8388608),
                    (eq, ":var_16", 0),
                    (val_or, ":var_15", 8388608),
                    (assign, ":var_20", 23),
                    (str_store_string, s0, "@Village Plunderer"),
                    (assign, reg0, 20),
                    (str_store_string, s1, "@(raided {reg0} villages)"),
                (else_try),
                    (store_and, ":var_16", "$g_achieve_bitfield", 67108864),
                    (neg|eq, ":var_16", 0),
                    (store_and, ":var_16", ":var_15", 67108864),
                    (eq, ":var_16", 0),
                    (val_or, ":var_15", 67108864),
                    (assign, ":var_20", 24),
                    (str_store_string, s0, "@Blatant Deceiver"),
                    (str_store_string, s1, "@(cheated in battle)"),
                (else_try),
                    (store_and, ":var_16", "$g_achieve_bitfield", 134217728),
                    (neg|eq, ":var_16", 0),
                    (store_and, ":var_16", ":var_15", 134217728),
                    (eq, ":var_16", 0),
                    (val_or, ":var_15", 134217728),
                    (assign, ":var_20", 25),
                    (str_store_string, s0, "@Order Grandmaster"),
                    (str_store_string, s1, "@(became a leader of a Knighthood Order)"),
                (try_end),
                (try_begin),
                    (neg|eq, ":var_20", -1),
                    (try_begin),
                        (ge, ":var_18", 0),
                        (val_sub, ":var_18", 1),
                    (try_end),
                    (eq, ":var_18", -1),
                    (val_add, ":var_17", 1),
                    (neg|ge, ":var_17", ":var_13"),
                    (store_mod, ":var_21", ":var_17", 2),
                    (store_mul, ":var_22", ":var_17", ":var_12"),
                    (store_sub, ":var_22", ":var_10", ":var_22"),
                    (try_begin),
                        (eq, ":var_21", 0),
                        (create_text_overlay, reg1, 0, 4),
                        (position_set_x, pos1, ":var_7"),
                    (else_try),
                        (create_text_overlay, reg1, 0, 8),
                        (position_set_x, pos1, ":var_8"),
                    (try_end),
                    (position_set_y, pos1, ":var_22"),
                    (overlay_set_position, reg1, pos1),
                    (store_mul, ":var_22", ":var_17", ":var_12"),
                    (store_sub, ":var_22", ":var_11", ":var_22"),
                    (try_begin),
                        (eq, ":var_21", 0),
                        (create_text_overlay, reg1, 1, 4),
                        (position_set_x, pos1, ":var_7"),
                    (else_try),
                        (create_text_overlay, reg1, 1, 8),
                        (position_set_x, pos1, ":var_8"),
                    (try_end),
                    (position_set_y, pos1, ":var_22"),
                    (overlay_set_position, reg1, pos1),
                    (position_set_x, pos1, 800),
                    (position_set_y, pos1, 800),
                    (overlay_set_size, reg1, pos1),
                    (create_mesh_overlay_with_tableau_material, reg1, -1, "tableau_achievement_troop", ":var_20"),
                    (try_begin),
                        (eq, ":var_21", 0),
                        (assign, ":var_23", ":var_5"),
                    (else_try),
                        (assign, ":var_23", ":var_6"),
                    (try_end),
                    (store_mul, ":var_24", ":var_17", ":var_12"),
                    (store_sub, ":var_24", ":var_9", ":var_24"),
                    (position_set_x, pos1, ":var_23"),
                    (position_set_y, pos1, ":var_24"),
                    (overlay_set_position, reg1, pos1),
                    (position_set_x, pos1, ":var_3"),
                    (position_set_y, pos1, ":var_3"),
                    (overlay_set_size, reg1, pos1),
                (try_end),
            (try_end),
        (try_end),
        (create_button_overlay, "$g_presentation_obj_1", "@More.", 16),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 40),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
        (create_button_overlay, "$g_presentation_obj_2", "@Back.", 16),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 40),
        (overlay_set_position, "$g_presentation_obj_2", pos1),
    ]),
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":var_0"),
        (try_begin),
            (eq, ":var_0", "$g_presentation_obj_1"),
            (assign, ":var_1", 5),
            (assign, ":var_2", "$g_achieve_bitfield"),
            (assign, ":var_3", 0),
            (assign, ":var_4", 0),
            (assign, ":var_5", 0),
            (try_begin),
                (store_and, ":var_5", ":var_2", 16777216),
                (neg|eq, ":var_5", 0),
                (val_sub, ":var_2", 16777216),
            (try_end),
            (try_begin),
                (store_and, ":var_5", ":var_2", 33554432),
                (neg|eq, ":var_5", 0),
                (val_sub, ":var_2", 33554432),
            (try_end),
            (try_for_range, ":var_6", 0, 28),
                (store_mod, ":var_7", ":var_2", 2),
                (try_begin),
                    (neg|eq, ":var_7", 0),
                    (val_add, ":var_4", 1),
                (try_end),
                (val_div, ":var_2", 2),
            (try_end),
            (store_add, ":var_3", "$g_achievement_page_no", 1),
            (val_mul, ":var_3", ":var_1"),
            (gt, ":var_4", ":var_3"),
            (val_add, "$g_achievement_page_no", 1),
            (start_presentation, "prsnt_achievement_report"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_2"),
            (assign, "$g_achievement_page_no", 0),
            (presentation_set_duration, 0),
            (change_screen_return),
        (try_end),
    ]),
]),

("achievement_notify", 0, mesh_load_window, [
    (ti_on_presentation_load, [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        (create_text_overlay, reg1, "@You have been awarded an Achievement!", 16),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 695),
        (overlay_set_position, reg1, pos1),
        (create_text_overlay, reg1, 11, 16),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 85),
        (overlay_set_position, reg1, pos1),
        (create_mesh_overlay_with_tableau_material, reg1, -1, "tableau_achievement_troop", reg11),
        (position_set_x, pos1, 200),
        (position_set_y, pos1, 180),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg1, pos1),
        (create_button_overlay, "$g_presentation_obj_1", "@Continue.", 16),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 35),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
    ]),
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":var_0"),
        (try_begin),
            (eq, ":var_0", "$g_presentation_obj_1"),
            (presentation_set_duration, 0),
            (change_screen_return),
        (try_end),
    ]),
]),

("order_founded", 0, mesh_load_window, [
    (ti_on_presentation_load, [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        (create_text_overlay, reg1, "@A Knighthood Order chapterhouse is founded", 16),
        (init_position, pos1),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 695),
        (overlay_set_position, reg1, pos1),
        (store_faction_of_party, ":var_0", "$g_notification_menu_var2"),
        (party_get_slot, ":var_1", "$g_notification_menu_var2", slot_town_lord),
        (str_store_troop_name, s11, ":var_1"),
        (str_store_faction_name, s12, ":var_0"),
        (str_store_faction_name, s13, "$g_notification_menu_var1"),
        (str_store_party_name, s14, "$g_notification_menu_var2"),
        (create_text_overlay, reg1, "@{s11} of the {s12} has founded a chapterhouse of the Order of the {s13} in {s14}.", 16),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 85),
        (overlay_set_position, reg1, pos1),
        (create_mesh_overlay_with_tableau_material, reg1, -1, "tableau_achievement_troop", 101),
        (position_set_x, pos1, 200),
        (position_set_y, pos1, 180),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg1, pos1),
        (create_button_overlay, "$g_presentation_obj_1", "@Continue.", 16),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 35),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
    ]),
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":var_0"),
        (try_begin),
            (eq, ":var_0", "$g_presentation_obj_1"),
            (presentation_set_duration, 0),
            (change_screen_return),
        (try_end),
    ]),
]),

("victory_screen_simple", 0, mesh_load_window, [
    (ti_on_presentation_load, [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        (str_store_faction_name, s11, "$players_kingdom"),
        (create_text_overlay, reg1, "@Pendor :  Conquered by {s11}", 16),
        (init_position, pos1),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 695),
        (overlay_set_position, reg1, pos1),
        (create_text_overlay, reg1, "@The {s11} has defeated all rivals and stands as the sole kingdom.  The Prophecy of Madigan has been fulfilled!^^ An Alternate Probability has been created.", 16),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 85),
        (overlay_set_position, reg1, pos1),
        (create_mesh_overlay_with_tableau_material, reg1, -1, "tableau_achievement_troop", 100),
        (position_set_x, pos1, 200),
        (position_set_y, pos1, 180),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg1, pos1),
        (create_button_overlay, "$g_presentation_obj_1", "@Continue.", 16),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 35),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
    ]),
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":var_0"),
        (try_begin),
            (eq, ":var_0", "$g_presentation_obj_1"),
            (presentation_set_duration, 0),
            (change_screen_return),
        (try_end),
    ]),
]),

("group_photo", 0, mesh_load_window, [
    (ti_on_presentation_load, [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        (create_text_overlay, reg1, "@Pendor :  Conquered by One Kingdom", 16),
        (init_position, pos1),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 695),
        (overlay_set_position, reg1, pos1),
        (store_troop_faction, ":var_0", "trp_player"),
        (str_store_faction_name, s11, ":var_0"),
        (create_text_overlay, reg1, "@{s11} has defeated all rivals and stands as the sole kingdom.  The Prophecy of Madigan has been fulfilled!^^ An Alternate Probability has been created.", 16),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 85),
        (overlay_set_position, reg1, pos1),
        (create_mesh_overlay_with_tableau_material, reg1, -1, "tableau_group_companions"),
        (position_set_x, pos1, 50),
        (position_set_y, pos1, 20),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg1, pos1),
        (create_button_overlay, "$g_presentation_obj_1", "@Continue.", 16),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 35),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
    ]),
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":var_0"),
        (try_begin),
            (eq, ":var_0", "$g_presentation_obj_1"),
            (presentation_set_duration, 0),
            (change_screen_return),
        (try_end),
    ]),
]),

("mini_map", prsntf_read_only, 0, [
    (ti_on_presentation_load, [
        (try_begin),
            (neg|eq, "$g_option_show_minimap", 0),
            (set_fixed_point_multiplier, 1000),
            (try_for_agents, ":var_0"),
                (agent_set_slot, ":var_0", slot_agent_map_overlay_id, 0),
            (try_end),
            (get_scene_boundaries, pos2, pos3),
            (position_transform_position_to_local, pos4, pos2, pos3),
            (set_fixed_point_multiplier, 1000),
            (position_get_x, ":var_1", pos4),
            (position_get_y, ":var_2", pos4),
            (set_fixed_point_multiplier, 1000),
            (store_div, ":var_3", ":var_2", 100),
            (store_div, ":var_3", ":var_1", ":var_3"),
            (try_begin),
                (gt, ":var_3", 100),
                (assign, "$g_battle_map_width", 200),
                (store_div, "$g_battle_map_scale", ":var_1", "$g_battle_map_width"),
                (store_div, "$g_battle_map_height", ":var_2", "$g_battle_map_scale"),
            (else_try),
                (assign, "$g_battle_map_height", 200),
                (store_div, "$g_battle_map_scale", ":var_2", "$g_battle_map_height"),
                (store_div, "$g_battle_map_width", ":var_1", "$g_battle_map_scale"),
            (try_end),
            (scene_prop_get_num_instances, ":var_4", "spr_inventory"),
            (try_begin),
                (gt, ":var_4", 0),
                (create_mesh_overlay, reg1, "mesh_white_dot"),
                (position_set_x, pos1, 200),
                (position_set_y, pos1, 200),
                (overlay_set_size, reg1, pos1),
                (overlay_set_alpha, reg1, 255),
                (overlay_set_color, reg1, 16777215),
                (assign, ":var_5", reg1),
                (get_scene_boundaries, pos2, pos3),
                (scene_prop_get_instance, ":var_6", "spr_inventory", 0),
                (prop_instance_get_position, pos1, ":var_6"),
                (call_script, "script_convert_3d_pos_to_map_pos"),
                (overlay_set_position, ":var_5", pos0),
            (try_end),
            (try_begin),
                (create_mesh_overlay, "$g_battle_map_plane", "mesh_white_plane"),
                (overlay_set_color, "$g_battle_map_plane", 0),
                (store_add, ":var_4", "$g_battle_map_width", 20),
                (store_add, ":var_5", "$g_battle_map_height", 20),
                (store_mul, ":var_6", ":var_4", 50),
                (store_mul, ":var_7", ":var_5", 50),
                (position_set_x, pos1, ":var_6"),
                (position_set_y, pos1, ":var_7"),
                (overlay_set_size, "$g_battle_map_plane", pos1),
                (store_sub, ":var_8", 990, ":var_4"),
                (store_sub, ":var_9", 740, ":var_5"),
                (position_set_x, pos1, ":var_8"),
                (position_set_y, pos1, ":var_9"),
                (overlay_set_position, "$g_battle_map_plane", pos1),
                (overlay_set_alpha, "$g_battle_map_plane", 34),
                (create_mesh_overlay, "$g_battle_map_infantry_order_flag", "mesh_flag_infantry"),
                (create_mesh_overlay, "$g_battle_map_archers_order_flag", "mesh_flag_archers"),
                (create_mesh_overlay, "$g_battle_map_cavalry_order_flag", "mesh_flag_cavalry"),
                (overlay_set_alpha, "$g_battle_map_infantry_order_flag", 0),
                (overlay_set_alpha, "$g_battle_map_archers_order_flag", 0),
                (overlay_set_alpha, "$g_battle_map_cavalry_order_flag", 0),
                (call_script, "script_update_order_panel_map"),
                (call_script, "script_update_order_flags_on_map"),
            (try_end),
        (try_end),
        (try_for_agents, ":var_10"),
            (agent_set_slot, ":var_10", 244, 0),
            (agent_set_slot, ":var_10", 243, 0),
        (try_end),
        (call_script, "script_update_agent_hp_bar"),
        (get_player_agent_no, ":var_11"),
        (agent_get_horse, ":var_12", ":var_11"),
        (troop_get_inventory_slot, ":var_11", "trp_player", 8),
        (try_begin),
            (ge, ":var_11", 0),
            (ge, "$g_encountered_party", 0),
            (ge, "$g_encountered_party_2", 0),
            (neg|is_between, "$g_encountered_party", "p_town_1", "p_village_1"),
            (neg|is_between, "$g_encountered_party_2", "p_town_1", "p_village_1"),
            (party_get_template_id, ":var_11", "$g_encountered_party"),
            (neg|is_between, ":var_11", "pt_steppe_bandit_lair", "pt_bandit_lair_templates_end"),
            (neg|ge, ":var_12", 0),
        (else_try),
            (assign, "$killcount_player_horse", ":var_12"),
        (try_end),
        (try_begin),
            (neg|eq, "$g_option_show_killcount", 0),
            (str_store_string, s1, "@Your kills: 0"),
            (create_text_overlay, "$g_presentation_obj_1", 1),
            (overlay_set_color, "$g_presentation_obj_1", 65280),
            (position_set_x, pos1, 10),
            (position_set_y, pos1, 700),
            (overlay_set_position, "$g_presentation_obj_1", pos1),
        (try_end),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_run, [
        (try_begin),
            (game_key_clicked, gk_view_orders),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_battle"),
        (else_try),
            (neg|eq, "$g_option_show_killcount", 0),
            (get_player_agent_no, ":var_0"),
            (agent_get_kill_count, reg0, ":var_0"),
            (agent_get_kill_count, reg1, ":var_0", 1),
            (val_add, reg1, reg0),
            (try_begin),
                (gt, "$killcount_player_horse", 0),
                (agent_get_kill_count, reg0, "$killcount_player_horse", 1),
                (val_add, reg1, reg0),
            (try_end),
            (str_store_string, s1, "@Your kills: {reg1}"),
            (overlay_set_text, "$g_presentation_obj_1", 1),
        (try_end),
    ]),
]),

("upgrade_trees", 0, mesh_load_window, [
    (ti_on_presentation_load, [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        (assign, "$g_presentation_next_presentation", -1),
        (create_combo_button_overlay, "$g_presentation_obj_1"),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 690),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
        (assign, ":var_0", 6),
        (store_sub, ":var_1", ":var_0", 1),
        (try_for_range_backwards, ":var_2", 0, ":var_0"),
            (store_add, ":var_3", ":var_2", "fac_kingdom_1"),
            (try_begin),
                (eq, ":var_3", "fac_kingdoms_end"),
                (assign, ":var_3", "fac_player_supporters_faction"),
            (try_end),
            (str_store_faction_name, s0, ":var_3"),
            (overlay_add_item, "$g_presentation_obj_1", 0),
        (try_end),
        (store_sub, ":var_4", ":var_1", "$temp_2"),
        (overlay_set_val, "$g_presentation_obj_1", ":var_4"),
        (create_text_overlay, reg1, "str_troop_upgrade_tree_tips", 4096),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 650),
        (position_set_y, pos1, 700),
        (overlay_set_position, reg1, pos1),
        (create_game_button_overlay, "$g_presentation_obj_2", "str_done"),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 25),
        (overlay_set_position, "$g_presentation_obj_2", pos1),
        (assign, ":var_5", -1),
        (store_add, ":var_3", "fac_kingdom_1", "$temp_2"),
        (try_begin),
            (eq, ":var_3", "fac_kingdoms_end"),
            (assign, ":var_3", "fac_player_supporters_faction"),
        (try_end),
        (try_begin),
            (is_between, ":var_3", "fac_kingdom_1", "fac_kingdoms_end"),
            (store_add, ":var_5", "mesh_pic_arms_swadian", "$temp_2"),
        (try_end),
        (try_begin),
            (gt, ":var_5", -1),
            (create_mesh_overlay, reg0, ":var_5"),
            (position_set_x, pos1, 80),
            (position_set_y, pos1, 640),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 300),
            (position_set_y, pos1, 300),
            (overlay_set_size, reg0, pos1),
        (try_end),
        (str_clear, s0),
        (create_text_overlay, "$g_presentation_obj_sliders_6", 0, 131072),
        (position_set_x, pos1, 15),
        (position_set_y, pos1, 80),
        (overlay_set_position, "$g_presentation_obj_sliders_6", pos1),
        (position_set_x, pos1, 950),
        (position_set_y, pos1, 600),
        (overlay_set_area_size, "$g_presentation_obj_sliders_6", pos1),
        (set_container_overlay, "$g_presentation_obj_sliders_6"),
        (try_begin),
            (eq, ":var_3", "fac_kingdom_1"),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 0, "trp_sarleon_recruit", 70, 100),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 1, "trp_sarleon_militia", 200, 100),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 2, "trp_sarleon_trained_militia", 330, 200),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 3, "trp_sarleon_footman", 460, 200),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 4, "trp_sarleon_arm_footman", 590, 200),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 5, "trp_sarleon_halberdier", 850, 200),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 6, "trp_sarleon_skirmisher", 330, 0),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 7, "trp_sarleon_longbowman", 460, 0),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 8, "trp_sarleon_arm_longbowman", 590, 0),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 9, "trp_sarleon_manatarms", 720, 200),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 10, "trp_marleons_cavalry", 590, 400),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 11, "trp_sarleon_knight", 460, 400),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 12, "trp_sarleon_nobleman", 200, 400),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 13, "trp_sarleon_squire", 330, 400),
            (assign, "$temp_3", 14),
            (call_script, "script_prsnt_lines_to_link_two_troops", 0, 1),
            (call_script, "script_prsnt_lines_to_link_two_troops", 1, 2),
            (call_script, "script_prsnt_lines_to_link_two_troops", 1, 6),
            (call_script, "script_prsnt_lines_to_link_two_troops", 2, 3),
            (call_script, "script_prsnt_lines_to_link_two_troops", 3, 4),
            (call_script, "script_prsnt_lines_to_link_two_troops", 4, 9),
            (call_script, "script_prsnt_lines_to_link_two_troops", 9, 5),
            (call_script, "script_prsnt_lines_to_link_two_troops", 6, 7),
            (call_script, "script_prsnt_lines_to_link_two_troops", 7, 8),
            (call_script, "script_prsnt_lines_to_link_two_troops", 12, 13),
            (call_script, "script_prsnt_lines_to_link_two_troops", 13, 11),
        (else_try),
            (eq, ":var_3", "fac_kingdom_2"),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 0, "trp_rav_recruit", 100, 300),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 1, "trp_rav_militia", 250, 300),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 2, "trp_rav_skirmisher", 400, 100),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 3, "trp_rav_archer", 550, 100),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 4, "trp_rav_warden", 700, 100),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 5, "trp_rav_ranger", 850, 200),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 6, "trp_rav_mounted_ranger", 850, 0),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 7, "trp_rav_trained_militia", 400, 500),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 8, "trp_rav_footman", 550, 500),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 9, "trp_rav_manatarms", 700, 500),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 10, "trp_rav_kierguard", 850, 600),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 11, "trp_rav_horseman", 850, 400),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 12, "trp_rav_nobleman", 250, 700),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 13, "trp_rav_squire", 400, 700),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 14, "trp_rav_knight", 550, 700),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 15, "trp_rav_kierguard_knight", 700, 700),
            (assign, "$temp_3", 16),
            (call_script, "script_prsnt_lines_to_link_two_troops", 0, 1),
            (call_script, "script_prsnt_lines_to_link_two_troops", 1, 2),
            (call_script, "script_prsnt_lines_to_link_two_troops", 1, 7),
            (call_script, "script_prsnt_lines_to_link_two_troops", 2, 3),
            (call_script, "script_prsnt_lines_to_link_two_troops", 3, 4),
            (call_script, "script_prsnt_lines_to_link_two_troops", 4, 5),
            (call_script, "script_prsnt_lines_to_link_two_troops", 4, 6),
            (call_script, "script_prsnt_lines_to_link_two_troops", 7, 8),
            (call_script, "script_prsnt_lines_to_link_two_troops", 8, 9),
            (call_script, "script_prsnt_lines_to_link_two_troops", 9, 10),
            (call_script, "script_prsnt_lines_to_link_two_troops", 9, 11),
            (call_script, "script_prsnt_lines_to_link_two_troops", 12, 13),
            (call_script, "script_prsnt_lines_to_link_two_troops", 13, 14),
        (else_try),
            (eq, ":var_3", "fac_kingdom_3"),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 0, "trp_dshar_tribesman", 100, 150),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 1, "trp_dshar_hunter", 250, 150),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 2, "trp_dshar_bowman", 400, 0),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 3, "trp_dshar_dervish", 550, 0),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 4, "trp_dshar_dervish_raider", 700, 0),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 5, "trp_dshar_spearman", 400, 300),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 6, "trp_dshar_veteran_spearman", 550, 300),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 7, "trp_dshar_warrior", 700, 200),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 8, "trp_dshar_bladesman", 700, 400),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 9, "trp_dshar_assassin", 850, 500),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 10, "trp_dshar_blademaster", 850, 300),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 11, "trp_dshar_nobleman", 250, 700),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 12, "trp_dshar_noble_raider", 400, 700),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 13, "trp_dshar_noble_cavalry", 550, 700),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 14, "trp_dshar_djaha", 700, 700),
            (assign, "$temp_3", 15),
            (call_script, "script_prsnt_lines_to_link_two_troops", 0, 1),
            (call_script, "script_prsnt_lines_to_link_two_troops", 1, 2),
            (call_script, "script_prsnt_lines_to_link_two_troops", 2, 3),
            (call_script, "script_prsnt_lines_to_link_two_troops", 3, 4),
            (call_script, "script_prsnt_lines_to_link_two_troops", 1, 5),
            (call_script, "script_prsnt_lines_to_link_two_troops", 5, 6),
            (call_script, "script_prsnt_lines_to_link_two_troops", 6, 7),
            (call_script, "script_prsnt_lines_to_link_two_troops", 5, 8),
            (call_script, "script_prsnt_lines_to_link_two_troops", 8, 9),
            (call_script, "script_prsnt_lines_to_link_two_troops", 8, 10),
            (call_script, "script_prsnt_lines_to_link_two_troops", 11, 12),
            (call_script, "script_prsnt_lines_to_link_two_troops", 12, 13),
        (else_try),
            (eq, ":var_3", "fac_kingdom_4"),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 0, "trp_fierd_recruit", 60, 150),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 1, "trp_fierd_militia", 200, 150),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 2, "trp_fierd_hunter", 340, 0),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 3, "trp_fierd_bowman", 480, 0),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 4, "trp_fierd_archer", 620, 0),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 5, "trp_fierd_heavy_archer", 760, 0),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 6, "trp_fierd_tr_militia", 340, 300),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 7, "trp_fierd_light_infantry", 480, 300),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 8, "trp_fierd_warrior", 620, 200),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 9, "trp_fierd_berserker", 760, 200),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 10, "trp_fierd_axeman", 620, 400),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 11, "trp_fierd_armored_axeman", 760, 400),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 12, "trp_fierd_huscarl", 900, 400),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 13, "trp_fierd_noblewoman", 250, 600),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 14, "trp_fierd_sword_maiden", 400, 600),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 15, "trp_valkyrie", 550, 600),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 16, "trp_valdis_huscarl", 700, 600),
            (assign, "$temp_3", 17),
            (call_script, "script_prsnt_lines_to_link_two_troops", 0, 1),
            (call_script, "script_prsnt_lines_to_link_two_troops", 1, 2),
            (call_script, "script_prsnt_lines_to_link_two_troops", 2, 3),
            (call_script, "script_prsnt_lines_to_link_two_troops", 3, 4),
            (call_script, "script_prsnt_lines_to_link_two_troops", 4, 5),
            (call_script, "script_prsnt_lines_to_link_two_troops", 1, 6),
            (call_script, "script_prsnt_lines_to_link_two_troops", 6, 7),
            (call_script, "script_prsnt_lines_to_link_two_troops", 7, 8),
            (call_script, "script_prsnt_lines_to_link_two_troops", 8, 9),
            (call_script, "script_prsnt_lines_to_link_two_troops", 8, 11),
            (call_script, "script_prsnt_lines_to_link_two_troops", 7, 10),
            (call_script, "script_prsnt_lines_to_link_two_troops", 10, 11),
            (call_script, "script_prsnt_lines_to_link_two_troops", 11, 12),
            (call_script, "script_prsnt_lines_to_link_two_troops", 13, 14),
            (call_script, "script_prsnt_lines_to_link_two_troops", 14, 15),
        (else_try),
            (eq, ":var_3", "fac_kingdom_5"),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 0, "trp_empire_citizen", 100, 225),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 1, "trp_empire_recruit", 250, 225),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 2, "trp_empire_militia", 400, 450),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 3, "trp_empire_light_infantry", 550, 450),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 4, "trp_empire_pikeman", 700, 600),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 5, "trp_empire_armored_pikeman", 850, 600),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 6, "trp_empire_infantry", 700, 300),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 7, "trp_empire_legionnaire", 850, 400),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 8, "trp_empire_gladiator", 850, 200),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 9, "trp_empire_hunter", 400, 0),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 10, "trp_empire_skirmisher", 550, 0),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 11, "trp_empire_crossbowman", 700, 0),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 12, "trp_empire_arm_crossbowman", 850, 0),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 13, "trp_empire_nobleman", 250, 900),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 14, "trp_empire_light_cavalry", 400, 800),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 15, "trp_empire_horseman", 550, 800),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 16, "trp_empire_noble_foot", 400, 1000),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 17, "trp_empire_knight", 550, 1000),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 18, "trp_empire_guardian_knight", 700, 800),
            (assign, "$temp_3", 19),
            (call_script, "script_prsnt_lines_to_link_two_troops", 0, 1),
            (call_script, "script_prsnt_lines_to_link_two_troops", 1, 2),
            (call_script, "script_prsnt_lines_to_link_two_troops", 2, 3),
            (call_script, "script_prsnt_lines_to_link_two_troops", 3, 4),
            (call_script, "script_prsnt_lines_to_link_two_troops", 4, 5),
            (call_script, "script_prsnt_lines_to_link_two_troops", 3, 6),
            (call_script, "script_prsnt_lines_to_link_two_troops", 6, 7),
            (call_script, "script_prsnt_lines_to_link_two_troops", 6, 8),
            (call_script, "script_prsnt_lines_to_link_two_troops", 1, 9),
            (call_script, "script_prsnt_lines_to_link_two_troops", 9, 10),
            (call_script, "script_prsnt_lines_to_link_two_troops", 10, 11),
            (call_script, "script_prsnt_lines_to_link_two_troops", 11, 12),
            (call_script, "script_prsnt_lines_to_link_two_troops", 13, 14),
            (call_script, "script_prsnt_lines_to_link_two_troops", 14, 15),
            (call_script, "script_prsnt_lines_to_link_two_troops", 13, 16),
            (call_script, "script_prsnt_lines_to_link_two_troops", 16, 17),
        (else_try),
            (eq, ":var_3", "fac_player_supporters_faction"),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 0, "trp_pendor_recruit", 100, 150),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 1, "trp_pendor_militia", 250, 300),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 2, "trp_pendor_light_bowman", 250, 0),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 3, "trp_pendor_heavy_bowman", 400, 0),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 4, "trp_pendor_armored_bowman", 550, 0),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 5, "trp_pendor_footman", 400, 300),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 6, "trp_pendor_swordsman", 550, 300),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 7, "trp_pendor_manatarms", 700, 200),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 8, "trp_pendor_cavalry", 700, 400),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 9, "trp_pendor_mtdmanatarms", 850, 400),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 10, "trp_pendor_nobleman", 250, 750),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 11, "trp_pendor_squire", 400, 900),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 12, "trp_pendor_knight", 550, 1000),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 13, "trp_pendor_foot_knight", 550, 800),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 14, "trp_pendor_noble_bowman", 400, 600),
            (call_script, "script_prsnt_upgrade_tree_troop_info", 15, "trp_pendor_gray_archer", 550, 600),
            (assign, "$temp_3", 16),
            (call_script, "script_prsnt_lines_to_link_two_troops", 0, 1),
            (call_script, "script_prsnt_lines_to_link_two_troops", 0, 2),
            (call_script, "script_prsnt_lines_to_link_two_troops", 2, 3),
            (call_script, "script_prsnt_lines_to_link_two_troops", 3, 4),
            (call_script, "script_prsnt_lines_to_link_two_troops", 1, 5),
            (call_script, "script_prsnt_lines_to_link_two_troops", 5, 6),
            (call_script, "script_prsnt_lines_to_link_two_troops", 6, 7),
            (call_script, "script_prsnt_lines_to_link_two_troops", 6, 8),
            (call_script, "script_prsnt_lines_to_link_two_troops", 8, 9),
            (call_script, "script_prsnt_lines_to_link_two_troops", 10, 11),
            (call_script, "script_prsnt_lines_to_link_two_troops", 11, 12),
            (call_script, "script_prsnt_lines_to_link_two_troops", 11, 13),
            (call_script, "script_prsnt_lines_to_link_two_troops", 10, 14),
            (call_script, "script_prsnt_lines_to_link_two_troops", 14, 15),
        (try_end),
        (set_container_overlay, -1),
    ]),
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":var_0"),
        (store_trigger_param_2, ":var_1"),
        (assign, ":var_2", 6),
        (store_sub, ":var_3", ":var_2", 1),
        (try_begin),
            (eq, ":var_0", "$g_presentation_obj_1"),
            (store_sub, "$temp_2", ":var_3", ":var_1"),
            (start_presentation, "prsnt_upgrade_trees"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_2"),
            (presentation_set_duration, 0),
        (try_end),
        (try_for_range, ":var_4", 0, "$temp_3"),
            (troop_slot_eq, "trp_temp_array_a", ":var_4", ":var_0"),
            (troop_get_slot, "$temp", "trp_temp_array_b", ":var_4"),
            (assign, "$g_presentation_next_presentation", "prsnt_upgrade_trees"),
            (start_presentation, "prsnt_troop_note"),
        (try_end),
    ]),
]),

("troop_note", 0, mesh_load_window, [
    (ti_on_presentation_load, [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        (call_script, "script_copy_inventory", "$temp", "trp_temp_array_a"),
        (try_for_range, ":var_0", 0, 10),
            (troop_get_inventory_slot, ":var_1", "trp_temp_array_a", ":var_0"),
            (troop_get_inventory_slot_modifier, ":var_2", "trp_temp_array_a", ":var_0"),
            (gt, ":var_1", -1),
            (troop_add_item, "trp_temp_array_a", ":var_1", ":var_2"),
            (troop_set_inventory_slot, "trp_temp_array_a", ":var_0", -1),
        (try_end),
        (create_game_button_overlay, "$g_presentation_obj_1", "str_done"),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 25),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
        (create_game_button_overlay, "$g_presentation_obj_sliders_3", "str_previous"),
        (position_set_x, pos1, 540),
        (position_set_y, pos1, 25),
        (overlay_set_position, "$g_presentation_obj_sliders_3", pos1),
        (create_game_button_overlay, "$g_presentation_obj_sliders_4", "str_next"),
        (position_set_x, pos1, 700),
        (position_set_y, pos1, 25),
        (overlay_set_position, "$g_presentation_obj_sliders_4", pos1),
        (create_text_overlay, reg0, "str_class_of_troop", 4112),
        (position_set_x, pos1, 875),
        (position_set_y, pos1, 340),
        (overlay_set_position, reg0, pos1),
        (create_combo_button_overlay, "$g_presentation_obj_sliders_5"),
        (position_set_x, pos1, 930),
        (position_set_y, pos1, 300),
        (overlay_set_position, "$g_presentation_obj_sliders_5", pos1),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 600),
        (overlay_set_size, "$g_presentation_obj_sliders_5", pos1),
        (assign, ":var_3", 6),
        (store_sub, ":var_4", ":var_3", 1),
        (try_for_range_backwards, ":var_5", 0, ":var_3"),
            (str_store_class_name, s0, ":var_5"),
            (overlay_add_item, "$g_presentation_obj_sliders_5", 0),
        (try_end),
        (troop_get_class, ":var_6", "$temp"),
        (store_sub, ":var_7", ":var_4", ":var_6"),
        (overlay_set_val, "$g_presentation_obj_sliders_5", ":var_7"),
        (store_mul, ":var_8", "$temp", 2),
        (create_mesh_overlay_with_tableau_material, reg0, -1, "tableau_game_party_window", ":var_8"),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 1000),
        (overlay_set_size, reg0, pos1),
        (position_set_x, pos1, 765),
        (position_set_y, pos1, 350),
        (overlay_set_position, reg0, pos1),
        (str_store_troop_name, s1, "$temp"),
        (store_character_level, ":var_9", "$temp"),
        (assign, reg1, ":var_9"),
        (str_store_string, s1, "str_name_s1_level_reg1"),
        (call_script, "script_get_troop_max_hp", "$temp"),
        (str_store_string, s1, "str_s1_hp_reg0"),
        (create_text_overlay, reg0, "str_s1", 2048),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 630),
        (overlay_set_position, reg0, pos1),
        (assign, ":var_10", 400),
        (assign, ":var_11", 590),
        (create_text_overlay, reg1, "str_attributes", 4),
        (store_add, ":var_12", ":var_10", 10),
        (position_set_x, pos1, ":var_12"),
        (position_set_y, pos1, ":var_11"),
        (overlay_set_position, reg1, pos1),
        (val_sub, ":var_11", 30),
        (try_for_range, ":var_13", 0, 4),
            (store_add, ":var_14", "str_attribute_str", ":var_13"),
            (str_store_string, s1, ":var_14"),
            (store_attribute_level, ":var_15", "$temp", ":var_13"),
            (assign, reg0, ":var_15"),
            (store_add, ":var_12", ":var_10", 10),
            (store_add, ":var_16", ":var_11", 10),
            (create_text_overlay, reg1, "str_s1_reg0_63", 4),
            (position_set_x, pos1, ":var_12"),
            (position_set_y, pos1, ":var_16"),
            (overlay_set_position, reg1, pos1),
            (position_set_x, pos1, 600),
            (position_set_y, pos1, 600),
            (overlay_set_size, reg1, pos1),
            (store_add, ":var_17", ":var_10", 10),
            (store_add, ":var_18", ":var_11", 0),
            (create_mesh_overlay, reg1, "mesh_white_plane"),
            (position_set_x, pos1, ":var_17"),
            (position_set_y, pos1, ":var_18"),
            (overlay_set_position, reg1, pos1),
            (position_set_x, pos1, 6300),
            (position_set_y, pos1, 400),
            (overlay_set_size, reg1, pos1),
            (overlay_set_color, reg1, 0),
            (overlay_set_alpha, reg1, 34),
            (create_mesh_overlay, reg1, "mesh_white_plane"),
            (position_set_x, pos1, ":var_17"),
            (position_set_y, pos1, ":var_18"),
            (overlay_set_position, reg1, pos1),
            (store_mul, ":var_19", ":var_15", 100),
            (val_min, ":var_19", 6300),
            (position_set_x, pos1, ":var_19"),
            (position_set_y, pos1, 400),
            (overlay_set_size, reg1, pos1),
            (overlay_set_color, reg1, 51),
            (overlay_set_alpha, reg1, 128),
            (val_add, ":var_10", 220),
            (try_begin),
                (eq, ":var_10", 840),
                (assign, ":var_10", 400),
                (val_sub, ":var_11", 30),
            (try_end),
        (try_end),
        (val_sub, ":var_11", 30),
        (create_text_overlay, reg1, "str_skills", 4),
        (store_add, ":var_12", ":var_10", 10),
        (position_set_x, pos1, ":var_12"),
        (position_set_y, pos1, ":var_11"),
        (overlay_set_position, reg1, pos1),
        (val_sub, ":var_11", 30),
        (try_for_range_backwards, ":var_20", 23, 37),
            (this_or_next|eq, ":var_20", 36),
            (this_or_next|eq, ":var_20", 35),
            (this_or_next|eq, ":var_20", 34),
            (this_or_next|eq, ":var_20", 33),
            (this_or_next|eq, ":var_20", 26),
            (this_or_next|eq, ":var_20", 25),
            (this_or_next|eq, ":var_20", 24),
            (eq, ":var_20", 23),
            (store_add, ":var_14", "str_skl_trade", ":var_20"),
            (str_store_string, s1, ":var_14"),
            (store_skill_level, ":var_21", ":var_20", "$temp"),
            (try_begin),
                (this_or_next|eq, ":var_20", 34),
                (this_or_next|eq, ":var_20", 35),
                (this_or_next|eq, ":var_20", 33),
                (eq, ":var_20", 36),
                (assign, ":var_22", 15),
            (else_try),
                (assign, ":var_22", 10),
            (try_end),
            (assign, reg2, ":var_21"),
            (assign, reg3, ":var_22"),
            (store_add, ":var_12", ":var_10", 10),
            (store_add, ":var_16", ":var_11", 10),
            (create_text_overlay, reg1, "str_s1_reg2_reg3", 4),
            (position_set_x, pos1, ":var_12"),
            (position_set_y, pos1, ":var_16"),
            (overlay_set_position, reg1, pos1),
            (position_set_x, pos1, 600),
            (position_set_y, pos1, 600),
            (overlay_set_size, reg1, pos1),
            (store_add, ":var_17", ":var_10", 10),
            (store_add, ":var_18", ":var_11", 0),
            (create_mesh_overlay, reg1, "mesh_white_plane"),
            (position_set_x, pos1, ":var_17"),
            (position_set_y, pos1, ":var_18"),
            (overlay_set_position, reg1, pos1),
            (store_mul, ":var_19", ":var_22", 600),
            (position_set_x, pos1, ":var_19"),
            (position_set_y, pos1, 400),
            (overlay_set_size, reg1, pos1),
            (overlay_set_color, reg1, 0),
            (overlay_set_alpha, reg1, 34),
            (create_mesh_overlay, reg1, "mesh_white_plane"),
            (position_set_x, pos1, ":var_17"),
            (position_set_y, pos1, ":var_18"),
            (overlay_set_position, reg1, pos1),
            (store_mul, ":var_19", ":var_21", 600),
            (position_set_x, pos1, ":var_19"),
            (position_set_y, pos1, 400),
            (overlay_set_size, reg1, pos1),
            (overlay_set_color, reg1, 13056),
            (overlay_set_alpha, reg1, 128),
            (val_add, ":var_10", 220),
            (try_begin),
                (eq, ":var_10", 840),
                (assign, ":var_10", 400),
                (val_sub, ":var_11", 30),
            (try_end),
        (try_end),
        (val_sub, ":var_11", 30),
        (create_text_overlay, reg1, "str_weapon_proficiencies", 4),
        (store_add, ":var_12", ":var_10", 10),
        (position_set_x, pos1, ":var_12"),
        (position_set_y, pos1, ":var_11"),
        (overlay_set_position, reg1, pos1),
        (val_sub, ":var_11", 30),
        (try_for_range, ":var_23", 0, 7),
            (store_add, ":var_14", "str_one_handed_weapon", ":var_23"),
            (str_store_string, s1, ":var_14"),
            (store_proficiency_level, ":var_24", "$temp", ":var_23"),
            (val_min, ":var_24", 699),
            (assign, reg0, ":var_24"),
            (store_add, ":var_12", ":var_10", 10),
            (store_add, ":var_16", ":var_11", 10),
            (create_text_overlay, reg1, "str_s1_reg0_699", 4),
            (position_set_x, pos1, ":var_12"),
            (position_set_y, pos1, ":var_16"),
            (overlay_set_position, reg1, pos1),
            (position_set_x, pos1, 600),
            (position_set_y, pos1, 600),
            (overlay_set_size, reg1, pos1),
            (store_add, ":var_17", ":var_10", 10),
            (store_add, ":var_18", ":var_11", 0),
            (create_mesh_overlay, reg1, "mesh_white_plane"),
            (position_set_x, pos1, ":var_17"),
            (position_set_y, pos1, ":var_18"),
            (overlay_set_position, reg1, pos1),
            (position_set_x, pos1, 17475),
            (position_set_y, pos1, 400),
            (overlay_set_size, reg1, pos1),
            (overlay_set_color, reg1, 0),
            (overlay_set_alpha, reg1, 34),
            (create_mesh_overlay, reg1, "mesh_white_plane"),
            (position_set_x, pos1, ":var_17"),
            (position_set_y, pos1, ":var_18"),
            (overlay_set_position, reg1, pos1),
            (store_mul, ":var_19", ":var_24", 25),
            (position_set_x, pos1, ":var_19"),
            (position_set_y, pos1, 400),
            (overlay_set_size, reg1, pos1),
            (overlay_set_color, reg1, 3342336),
            (overlay_set_alpha, reg1, 128),
            (val_sub, ":var_11", 30),
        (try_end),
        (create_text_overlay, reg1, "str_equipments", 4096),
        (position_set_x, pos1, 50),
        (position_set_y, pos1, 635),
        (overlay_set_position, reg1, pos1),
        (str_clear, s0),
        (create_text_overlay, "$g_presentation_obj_2", 0, 8192),
        (position_set_x, pos1, 40),
        (position_set_y, pos1, 50),
        (overlay_set_position, "$g_presentation_obj_2", pos1),
        (position_set_x, pos1, 330),
        (position_set_y, pos1, 560),
        (overlay_set_area_size, "$g_presentation_obj_2", pos1),
        (set_container_overlay, "$g_presentation_obj_2"),
        (assign, ":var_10", 0),
        (assign, ":var_11", 1840),
        (assign, ":var_25", 10),
        (try_for_range, ":var_26", 0, 24),
            (try_for_range, ":var_27", 0, 4),
                (create_mesh_overlay, reg1, "mesh_mp_inventory_choose"),
                (position_set_x, pos1, 640),
                (position_set_y, pos1, 640),
                (overlay_set_size, reg1, pos1),
                (position_set_x, pos1, ":var_10"),
                (position_set_y, pos1, ":var_11"),
                (overlay_set_position, reg1, pos1),
                (troop_set_slot, "trp_temp_array_a", ":var_25", reg1),
                (create_mesh_overlay, reg1, "mesh_inv_slot"),
                (position_set_x, pos1, 800),
                (position_set_y, pos1, 800),
                (overlay_set_size, reg1, pos1),
                (position_set_x, pos1, ":var_10"),
                (position_set_y, pos1, ":var_11"),
                (overlay_set_position, reg1, pos1),
                (troop_get_inventory_slot, ":var_28", "trp_temp_array_a", ":var_25"),
                (try_begin),
                    (gt, ":var_28", -1),
                    (create_mesh_overlay_with_item_id, reg1, ":var_28"),
                    (position_set_x, pos1, 800),
                    (position_set_y, pos1, 800),
                    (overlay_set_size, reg1, pos1),
                    (store_add, ":var_29", ":var_10", 40),
                    (store_add, ":var_30", ":var_11", 40),
                    (position_set_x, pos1, ":var_29"),
                    (position_set_y, pos1, ":var_30"),
                    (overlay_set_position, reg1, pos1),
                    (troop_set_slot, "trp_temp_array_b", ":var_25", reg1),
                (try_end),
                (val_add, ":var_10", 80),
                (val_add, ":var_25", 1),
            (try_end),
            (assign, ":var_10", 0),
            (val_sub, ":var_11", 80),
        (try_end),
        (set_container_overlay, -1),
    ]),
    (ti_on_presentation_mouse_enter_leave, [
        (store_trigger_param_1, ":var_0"),
        (store_trigger_param_2, ":var_1"),
        (try_begin),
            (eq, ":var_1", 0),
            (try_for_range, ":var_2", 10, 106),
                (troop_slot_eq, "trp_temp_array_a", ":var_2", ":var_0"),
                (troop_get_inventory_slot, ":var_3", "trp_temp_array_a", ":var_2"),
                (troop_get_inventory_slot_modifier, ":var_4", "trp_temp_array_a", ":var_2"),
                (try_begin),
                    (gt, ":var_3", -1),
                    (troop_get_slot, ":var_5", "trp_temp_array_b", ":var_2"),
                    (overlay_get_position, 0, ":var_5"),
                    (show_item_details_with_modifier, ":var_3", ":var_4", pos0, 100),
                    (assign, "$g_current_opened_item_details", ":var_2"),
                (try_end),
            (try_end),
        (else_try),
            (try_for_range, ":var_2", 10, 106),
                (troop_slot_eq, "trp_temp_array_a", ":var_2", ":var_0"),
                (try_begin),
                    (eq, "$g_current_opened_item_details", ":var_2"),
                    (close_item_details),
                (try_end),
            (try_end),
        (try_end),
    ]),
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":var_0"),
        (store_trigger_param_2, ":var_1"),
        (try_begin),
            (key_is_down, key_left_control),
            (assign, ":var_2", 5),
        (else_try),
            (key_is_down, key_left_shift),
            (assign, ":var_2", 10),
        (else_try),
            (key_is_down, key_left_alt),
            (assign, ":var_2", 20),
        (else_try),
            (assign, ":var_2", 1),
        (try_end),
        (try_begin),
            (eq, ":var_0", "$g_presentation_obj_sliders_3"),
            (val_sub, "$temp", ":var_2"),
            (val_max, "$temp", 0),
            (start_presentation, "prsnt_troop_note"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_sliders_4"),
            (val_add, "$temp", ":var_2"),
            (val_min, "$temp", "trp_relative_of_merchants_end"),
            (start_presentation, "prsnt_troop_note"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_1"),
            (try_begin),
                (gt, "$g_presentation_next_presentation", -1),
                (start_presentation, "$g_presentation_next_presentation"),
            (else_try),
                (presentation_set_duration, 0),
            (try_end),
        (try_end),
    ]),
]),

("numeric_input", 0, mesh_load_window, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (create_number_box_overlay, reg1, 0, 9999),
        (position_set_x, pos1, 470),
        (position_set_y, pos1, 350),
        (overlay_set_position, reg1, pos1),
        (item_get_slot, ":var_0", "itm_no_item", "$temp"),
        (overlay_set_val, reg1, ":var_0"),
        (assign, "$g_presentation_obj_1", reg1),
        (create_game_button_overlay, "$g_presentation_obj_2", "@Continue."),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 25),
        (overlay_set_position, "$g_presentation_obj_2", pos1),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":var_0"),
        (store_trigger_param_2, ":var_1"),
        (try_begin),
            (eq, ":var_0", "$g_presentation_obj_1"),
            (item_set_slot, "itm_no_item", "$temp", ":var_1"),
        (else_try),
            (eq, ":var_0", "$g_presentation_obj_2"),
            (presentation_set_duration, 0),
        (else_try),
            (key_clicked, key_escape),
            (presentation_set_duration, 0),
        (try_end),
    ]),
]),

("change_commander", 0, mesh_load_window, [
    (ti_on_presentation_load, [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        (position_set_x, pos1, 630),
        (position_set_y, pos1, 650),
        (str_store_troop_name, s0, "$g_player_troop"),
        (str_store_string, s1, "str_please_reselect_a_companion"),
        (create_text_overlay, "$g_presentation_obj_1", "str_s1", 4112),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
        (create_game_button_overlay, "$g_presentation_obj_2", "str_done"),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 25),
        (overlay_set_position, "$g_presentation_obj_2", pos1),
        (str_clear, s0),
        (create_text_overlay, "$g_presentation_obj_sliders_6", 0, 8192),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 150),
        (overlay_set_position, "$g_presentation_obj_sliders_6", pos1),
        (position_set_x, pos1, 180),
        (position_set_y, pos1, 400),
        (overlay_set_area_size, "$g_presentation_obj_sliders_6", pos1),
        (set_container_overlay, "$g_presentation_obj_sliders_6"),
        (call_script, "script_get_num_heroes_of_party", "p_main_party", 1),
        (assign, ":var_0", reg0),
        (try_begin),
            (neg|gt, ":var_0", 10),
            (assign, ":var_1", 400),
        (else_try),
            (store_mul, ":var_1", ":var_0", 40),
        (try_end),
        (val_sub, ":var_1", 40),
        (assign, ":var_2", 90),
        (assign, ":var_3", 0),
        (store_character_level, ":var_4", "trp_player"),
        (party_get_num_companion_stacks, ":var_5", "p_main_party"),
        (try_for_range, ":var_6", 0, ":var_5"),
            (party_stack_get_troop_id, ":var_7", "p_main_party", ":var_6"),
            (troop_is_hero, ":var_7"),
            (store_character_level, ":var_8", ":var_7"),
            (neg|gt, ":var_8", ":var_4"),
            (neg|troop_is_wounded, ":var_7"),
            (str_store_troop_name, s1, ":var_7"),
            (position_set_x, pos1, ":var_2"),
            (position_set_y, pos1, ":var_1"),
            (val_sub, ":var_1", 40),
            (create_button_overlay, reg0, "str_s1", 16),
            (overlay_set_position, reg0, pos1),
            (troop_set_slot, "trp_temp_array_a", ":var_3", reg0),
            (troop_set_slot, "trp_temp_array_b", ":var_3", ":var_7"),
            (val_add, ":var_3", 1),
        (try_end),
        (set_container_overlay, -1),
        (store_mul, ":var_9", "$g_player_troop", 2),
        (create_mesh_overlay_with_tableau_material, reg0, -1, "tableau_game_party_window", ":var_9"),
        (position_set_x, pos1, 675),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg0, pos1),
        (position_set_x, pos1, 110),
        (position_set_y, pos1, 40),
        (overlay_set_position, reg0, pos1),
        (create_mesh_overlay, reg1, "mesh_inventory_equipment_panel"),
        (position_set_x, pos1, 960),
        (position_set_y, pos1, 960),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 10),
        (position_set_y, pos1, 15),
        (overlay_set_position, reg1, pos1),
        (assign, ":var_10", 219),
        (assign, ":var_11", 683),
        (assign, ":var_9", "$g_player_troop"),
        (assign, ":var_12", "trp_zendar_chest"),
        (create_text_overlay, reg1, "str_arms", 16),
        (store_add, ":var_2", ":var_10", 42),
        (store_add, ":var_1", ":var_11", 2),
        (position_set_x, pos1, ":var_2"),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg1, pos1),
        (create_text_overlay, reg1, "str_outfit", 16),
        (store_add, ":var_2", ":var_10", -98),
        (store_add, ":var_1", ":var_11", 2),
        (position_set_x, pos1, ":var_2"),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg1, pos1),
        (create_text_overlay, reg1, "str_horse", 16),
        (store_add, ":var_2", ":var_10", -140),
        (store_add, ":var_1", ":var_11", -278),
        (position_set_x, pos1, ":var_2"),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg1, pos1),
        (assign, "$g_current_opened_item_details", -1),
        (assign, ":var_2", ":var_10"),
        (assign, ":var_1", ":var_11"),
        (try_for_range, ":var_13", 0, 9),
            (try_begin),
                (eq, ":var_13", 4),
                (val_sub, ":var_2", 96),
                (assign, ":var_1", ":var_11"),
            (else_try),
                (eq, ":var_13", 7),
                (val_sub, ":var_2", 84),
                (store_sub, ":var_1", ":var_11", 85),
            (else_try),
                (eq, ":var_13", 8),
                (val_sub, ":var_1", 108),
            (try_end),
            (val_sub, ":var_1", 85),
            (troop_get_inventory_slot, ":var_14", ":var_9", ":var_13"),
            (try_begin),
                (gt, ":var_14", -1),
                (assign, ":var_15", "mesh_inv_slot"),
                (create_mesh_overlay, reg1, ":var_15"),
                (position_set_x, pos1, 820),
                (position_set_y, pos1, 820),
                (overlay_set_size, reg1, pos1),
                (position_set_x, pos1, ":var_2"),
                (position_set_y, pos1, ":var_1"),
                (overlay_set_position, reg1, pos1),
            (try_end),
            (try_begin),
                (gt, ":var_14", -1),
                (create_mesh_overlay_with_item_id, reg1, ":var_14"),
                (position_set_x, pos1, 800),
                (position_set_y, pos1, 800),
                (overlay_set_size, reg1, pos1),
                (store_add, ":var_16", ":var_2", 40),
                (store_add, ":var_17", ":var_1", 40),
                (position_set_x, pos1, ":var_16"),
                (position_set_y, pos1, ":var_17"),
                (overlay_set_position, reg1, pos1),
                (troop_set_slot, ":var_12", ":var_13", reg1),
            (else_try),
                (troop_set_slot, ":var_12", ":var_13", -1),
            (try_end),
        (try_end),
        (str_store_troop_name, s1, "$g_player_troop"),
        (store_character_level, ":var_18", "$g_player_troop"),
        (assign, reg1, ":var_18"),
        (str_store_string, s1, "str_name_s1_level_reg1"),
        (store_troop_health, ":var_19", "$g_player_troop", 1),
        (call_script, "script_get_troop_max_hp", "$g_player_troop"),
        (assign, reg1, ":var_19"),
        (assign, reg2, reg0),
        (str_store_string, s1, "str_s1_hp_reg1_reg2"),
        (create_text_overlay, reg0, "str_s1", 2048),
        (position_set_x, pos1, 10),
        (position_set_y, pos1, 180),
        (overlay_set_position, reg0, pos1),
        (assign, ":var_2", 360),
        (assign, ":var_1", 550),
        (create_text_overlay, reg1, "str_attributes", 4),
        (store_add, ":var_20", ":var_2", 10),
        (position_set_x, pos1, ":var_20"),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg1, pos1),
        (val_sub, ":var_1", 30),
        (try_for_range, ":var_21", 0, 4),
            (store_add, ":var_22", "str_attribute_str", ":var_21"),
            (str_store_string, s1, ":var_22"),
            (store_attribute_level, ":var_23", "$g_player_troop", ":var_21"),
            (assign, reg0, ":var_23"),
            (store_add, ":var_20", ":var_2", 10),
            (store_add, ":var_24", ":var_1", 10),
            (create_text_overlay, reg1, "str_s1_reg0_63", 4),
            (position_set_x, pos1, ":var_20"),
            (position_set_y, pos1, ":var_24"),
            (overlay_set_position, reg1, pos1),
            (position_set_x, pos1, 600),
            (position_set_y, pos1, 600),
            (overlay_set_size, reg1, pos1),
            (store_add, ":var_25", ":var_2", 10),
            (store_add, ":var_26", ":var_1", 0),
            (create_mesh_overlay, reg1, "mesh_white_plane"),
            (position_set_x, pos1, ":var_25"),
            (position_set_y, pos1, ":var_26"),
            (overlay_set_position, reg1, pos1),
            (position_set_x, pos1, 6300),
            (position_set_y, pos1, 400),
            (overlay_set_size, reg1, pos1),
            (overlay_set_color, reg1, 0),
            (overlay_set_alpha, reg1, 34),
            (create_mesh_overlay, reg1, "mesh_white_plane"),
            (position_set_x, pos1, ":var_25"),
            (position_set_y, pos1, ":var_26"),
            (overlay_set_position, reg1, pos1),
            (store_mul, ":var_27", ":var_23", 100),
            (val_min, ":var_27", 6300),
            (position_set_x, pos1, ":var_27"),
            (position_set_y, pos1, 400),
            (overlay_set_size, reg1, pos1),
            (overlay_set_color, reg1, 51),
            (overlay_set_alpha, reg1, 128),
            (val_add, ":var_2", 220),
            (try_begin),
                (eq, ":var_2", 800),
                (assign, ":var_2", 360),
                (val_sub, ":var_1", 30),
            (try_end),
        (try_end),
        (val_sub, ":var_1", 30),
        (create_text_overlay, reg1, "str_skills", 4),
        (store_add, ":var_20", ":var_2", 10),
        (position_set_x, pos1, ":var_20"),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg1, pos1),
        (val_sub, ":var_1", 30),
        (try_for_range_backwards, ":var_28", 23, 37),
            (this_or_next|eq, ":var_28", 36),
            (this_or_next|eq, ":var_28", 35),
            (this_or_next|eq, ":var_28", 34),
            (this_or_next|eq, ":var_28", 33),
            (this_or_next|eq, ":var_28", 26),
            (this_or_next|eq, ":var_28", 25),
            (this_or_next|eq, ":var_28", 24),
            (eq, ":var_28", 23),
            (store_add, ":var_22", "str_skl_trade", ":var_28"),
            (str_store_string, s1, ":var_22"),
            (store_skill_level, ":var_29", ":var_28", "$g_player_troop"),
            (try_begin),
                (this_or_next|eq, ":var_28", 34),
                (this_or_next|eq, ":var_28", 35),
                (this_or_next|eq, ":var_28", 33),
                (eq, ":var_28", 36),
                (assign, ":var_30", 15),
            (else_try),
                (assign, ":var_30", 10),
            (try_end),
            (assign, reg2, ":var_29"),
            (assign, reg3, ":var_30"),
            (store_add, ":var_20", ":var_2", 10),
            (store_add, ":var_24", ":var_1", 10),
            (create_text_overlay, reg1, "str_s1_reg2_reg3", 4),
            (position_set_x, pos1, ":var_20"),
            (position_set_y, pos1, ":var_24"),
            (overlay_set_position, reg1, pos1),
            (position_set_x, pos1, 600),
            (position_set_y, pos1, 600),
            (overlay_set_size, reg1, pos1),
            (store_add, ":var_25", ":var_2", 10),
            (store_add, ":var_26", ":var_1", 0),
            (create_mesh_overlay, reg1, "mesh_white_plane"),
            (position_set_x, pos1, ":var_25"),
            (position_set_y, pos1, ":var_26"),
            (overlay_set_position, reg1, pos1),
            (store_mul, ":var_27", ":var_30", 600),
            (position_set_x, pos1, ":var_27"),
            (position_set_y, pos1, 400),
            (overlay_set_size, reg1, pos1),
            (overlay_set_color, reg1, 0),
            (overlay_set_alpha, reg1, 34),
            (create_mesh_overlay, reg1, "mesh_white_plane"),
            (position_set_x, pos1, ":var_25"),
            (position_set_y, pos1, ":var_26"),
            (overlay_set_position, reg1, pos1),
            (store_mul, ":var_27", ":var_29", 600),
            (position_set_x, pos1, ":var_27"),
            (position_set_y, pos1, 400),
            (overlay_set_size, reg1, pos1),
            (overlay_set_color, reg1, 13056),
            (overlay_set_alpha, reg1, 128),
            (val_add, ":var_2", 220),
            (try_begin),
                (eq, ":var_2", 800),
                (assign, ":var_2", 360),
                (val_sub, ":var_1", 30),
            (try_end),
        (try_end),
        (val_sub, ":var_1", 30),
        (create_text_overlay, reg1, "str_weapon_proficiencies", 4),
        (store_add, ":var_20", ":var_2", 10),
        (position_set_x, pos1, ":var_20"),
        (position_set_y, pos1, ":var_1"),
        (overlay_set_position, reg1, pos1),
        (val_sub, ":var_1", 30),
        (try_for_range, ":var_31", 0, 7),
            (store_add, ":var_22", "str_one_handed_weapon", ":var_31"),
            (str_store_string, s1, ":var_22"),
            (store_proficiency_level, ":var_32", "$g_player_troop", ":var_31"),
            (val_min, ":var_32", 699),
            (assign, reg0, ":var_32"),
            (store_add, ":var_20", ":var_2", 10),
            (store_add, ":var_24", ":var_1", 10),
            (create_text_overlay, reg1, "str_s1_reg0_699", 4),
            (position_set_x, pos1, ":var_20"),
            (position_set_y, pos1, ":var_24"),
            (overlay_set_position, reg1, pos1),
            (position_set_x, pos1, 600),
            (position_set_y, pos1, 600),
            (overlay_set_size, reg1, pos1),
            (store_add, ":var_25", ":var_2", 10),
            (store_add, ":var_26", ":var_1", 0),
            (create_mesh_overlay, reg1, "mesh_white_plane"),
            (position_set_x, pos1, ":var_25"),
            (position_set_y, pos1, ":var_26"),
            (overlay_set_position, reg1, pos1),
            (position_set_x, pos1, 17475),
            (position_set_y, pos1, 400),
            (overlay_set_size, reg1, pos1),
            (overlay_set_color, reg1, 0),
            (overlay_set_alpha, reg1, 34),
            (create_mesh_overlay, reg1, "mesh_white_plane"),
            (position_set_x, pos1, ":var_25"),
            (position_set_y, pos1, ":var_26"),
            (overlay_set_position, reg1, pos1),
            (store_mul, ":var_27", ":var_32", 25),
            (position_set_x, pos1, ":var_27"),
            (position_set_y, pos1, 400),
            (overlay_set_size, reg1, pos1),
            (overlay_set_color, reg1, 3342336),
            (overlay_set_alpha, reg1, 128),
            (val_sub, ":var_1", 30),
        (try_end),
    ]),
    (ti_on_presentation_mouse_enter_leave, [
        (store_trigger_param_1, ":var_0"),
        (store_trigger_param_2, ":var_1"),
        (try_begin),
            (eq, ":var_1", 0),
            (try_for_range, ":var_2", 0, 9),
                (troop_slot_eq, "trp_zendar_chest", ":var_2", ":var_0"),
                (overlay_get_position, 0, ":var_0"),
                (troop_get_inventory_slot, ":var_3", "$g_player_troop", ":var_2"),
                (troop_get_inventory_slot_modifier, ":var_4", "$g_player_troop", ":var_2"),
                (try_begin),
                    (gt, ":var_4", 0),
                    (show_item_details_with_modifier, ":var_3", ":var_4", pos0, 100),
                (else_try),
                    (show_item_details, ":var_3", pos0, 100),
                (try_end),
                (assign, "$g_current_opened_item_details", ":var_2"),
            (try_end),
        (else_try),
            (try_for_range, ":var_2", 0, 9),
                (troop_slot_eq, "trp_zendar_chest", ":var_2", ":var_0"),
                (try_begin),
                    (eq, "$g_current_opened_item_details", ":var_2"),
                    (close_item_details),
                (try_end),
            (try_end),
        (try_end),
    ]),
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":var_0"),
        (try_begin),
            (eq, ":var_0", "$g_presentation_obj_2"),
            (presentation_set_duration, 0),
        (try_end),
        (call_script, "script_get_num_heroes_of_party", "p_main_party", 1),
        (assign, ":var_1", reg0),
        (try_for_range, ":var_2", 0, ":var_1"),
            (troop_slot_eq, "trp_temp_array_a", ":var_2", ":var_0"),
            (troop_get_slot, ":var_3", "trp_temp_array_b", ":var_2"),
            (assign, "$g_player_troop", ":var_3"),
            (start_presentation, "prsnt_change_commander"),
        (try_end),
    ]),
]),


]